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

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 
    } 
主站蜘蛛池模板: 从化市| 额济纳旗| 汝州市| 凤冈县| 万年县| 鄂伦春自治旗| 原阳县| 高雄市| 年辖:市辖区| 仲巴县| 潍坊市| 天祝| 兴国县| 张北县| 淮阳县| 梅州市| 松江区| 马尔康县| 尼勒克县| 海盐县| 资兴市| 拜城县| 翁牛特旗| 武鸣县| 永善县| 贵德县| 伊春市| 突泉县| 凌源市| 徐水县| 周口市| 张家口市| 永年县| 沙雅县| 天峨县| 习水县| 江都市| 中西区| 德江县| 安丘市| 姚安县|