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 
    } 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.253.221