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

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 
    } 
主站蜘蛛池模板: 安远县| 砀山县| 喀什市| 固阳县| 开鲁县| 道真| 都江堰市| 江永县| 永嘉县| 扎赉特旗| 巴林左旗| 库车县| 常山县| 铁力市| 白朗县| 海淀区| 枝江市| 延长县| 永泰县| 富平县| 清原| 怀集县| 怀远县| 衡阳县| 苗栗市| 密云县| 常德市| 蒙自县| 万全县| 建宁县| 丰城市| 隆安县| 长寿区| 福海县| 孝义市| 额济纳旗| 鸡泽县| 新疆| 吉林市| 科技| 宽城|