<Window x:Class="Demo_window.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Demo_window"
Title="Window2" Height="300" Width="300"
>
<Grid x:Name="grid_1">
<Grid x:Name="grid_2" local:Student.Test="ddd">
<Grid x:Name="grid_3" >
<StackPanel x:Name="sp_1" >
<!--Button.Click="Button_Click"是安装方式,当前控件安装了Button.Click事件侦听器,当该事件被激发时,会调用Button.Click事件的处理方法-->
<!--Click="Button_Click"是button1控件自身带的CLR事件进行订阅{调用CLR事件的add访问器}-->
<Button x:Name="button1" Width="80" Height="80" Button.Click="Button_Click" Click="Button_Click"/>
</StackPanel>
</Grid>
</Grid>
</Grid>
</Window>
时间: 2024-10-25 16:20:28