Syncfusion WPF FAQ
Questions and answers in this FAQ have been collected from newsgroup posts, various mailing lists and the employees of Syncfusion.

5. Concepts Routed Events

FAQ Home
   5.1 What is a Routed event?
   5.2 How can I handle the input event through XAML?



5.1 What is a Routed event?


In a typical WPF application, it contains many elements. These elements exist in an element tree relationship with each other. A routed event is a type of event that can invoke handlers on multiple listeners in an element tree, rather than just on the object that raised the event.

Routing events uses one of the three following strategies:

  • Bubbling: Event handlers on the event source are invoked.
  • Direct: Only the source element itself is given the opportunity to invoke handlers in response.
  • Tunneling: Initially, event handlers at the element tree root are invoked.


5.2 How can I handle the input event through XAML?


To receive input on an element, an event handler must be associated with that particular event. In XAML the markup is defined and its event handler must be written in code (such as C# / VB in a code-behind file).

[XAML]

<Button Click="Button1_Click" />



[C#]

void Button1_Click(object sender, RoutedEventArgs args)
{
//logic to handle the Click event

...

}



© 2001-2008 Copyright Syncfusion Inc. All rights reserved.  |  Privacy Policy  |  Contact  |  Sitemap