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

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 
    } 
主站蜘蛛池模板: 天祝| 铜陵市| 泸定县| 上高县| 汉寿县| 平阴县| 肃北| 阳春市| 集贤县| 武安市| 遂平县| 犍为县| 临猗县| 咸宁市| 吴堡县| 扎赉特旗| 英超| 南陵县| 灵川县| 当雄县| 化隆| 昌吉市| 即墨市| 梁山县| 罗甸县| 安西县| 文水县| 桑日县| 昂仁县| 珠海市| 泸西县| 湛江市| 旌德县| 库尔勒市| 南雄市| 抚远县| 噶尔县| 青州市| 望奎县| 永平县| 陵川县|