官术网_书友最值得收藏!

Event attribute syntax

In XAML, you can also define events for a specific object element. Though it looks like property attribute, but is used to assign the event. If the attribute value of an element is the name of an event, it is treated as an event. In the following code snippet, the Click attribute defines the click event of the buttons:

    <Button Click="Button_Click">Click Here</Button> 
    <Button Click="Button_Click" Content="Click Here" /> 

The implementation of the event handler is generally defined in the code behind of the XAML page. The event implementation for the preceding button click event looks like this:

    void Button_Click(object sender, RoutedEventArgs e) 
    { 
      // event implementation 
    } 
主站蜘蛛池模板: 晋城| 松原市| 察隅县| 建阳市| 灵丘县| 巩义市| 常州市| 瑞丽市| 北票市| 林州市| 凤山市| 吉首市| 广灵县| 清水河县| 舞钢市| 鹰潭市| 绩溪县| 通化县| 中阳县| 永安市| 金山区| 平度市| 遵义市| 连平县| 杭锦旗| 元氏县| 仁寿县| 安吉县| 苏尼特右旗| 尉氏县| 新竹县| 巴青县| 巴青县| 江西省| 长阳| 连城县| 深圳市| 朝阳区| 白玉县| 石嘴山市| 香格里拉县|