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

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 
    } 
主站蜘蛛池模板: 曲周县| 政和县| 赞皇县| 汉中市| 封丘县| 读书| 浦城县| 明溪县| 云霄县| 保康县| 河源市| 金塔县| 定陶县| 曲靖市| 芒康县| 永川市| 称多县| 安泽县| 和林格尔县| 峨眉山市| 胶州市| 祁阳县| 宁河县| 东方市| 沛县| 横山县| 平原县| 喀什市| 衡阳县| 花莲市| 荆门市| 格尔木市| 分宜县| 都安| 宜阳县| 绥中县| 凌云县| 车险| 郸城县| 吉木萨尔县| 蒙阴县|