This example shows how to add an event handler to a Button in XAML and write the handler that can process the routed event data.
Example
Description
Routed events typically follow one of two routing strategies, bubbling or tunneling. This example focuses on the bubbling event and shows how to handle the Click event of a Button.
Code
XAML | ![]() |
---|---|
<Grid x:Name="LayoutRoot"> <StackPanel> <Intersoft:UXButton Name="button1" Click="button1_Click" Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" /> </StackPanel> </Grid> |
C# | ![]() |
---|---|
private void button1_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Button1 Clicked"); } |