You must Sign In to post a response.
  • Category: .NET

    what is event bubbling and event tunneling??

    Hi all..
    what is event bubbling and event tunneling?? please telll me with some examples /.....
  • #198857
    Routed events use one of three routing strategies:
    Bubbling: Event handlers on the event source are invoked. The routed event then routes to successive parent elements until reaching the element tree root. Most routed events use the bubbling routing strategy. Bubbling routed events are generally used to report input or state changes from distinct controls or other UI elements.

    Tunneling: Initially, event handlers at the element tree root are invoked. The routed event then travels a route through successive child elements along the route, towards the node element that is the routed event source (the element that raised the routed event). Tunneling routed events are often used or handled as part of the compositing for a control, such that events from composite parts can be deliberately suppressed or replaced by events that are specific to the complete control. Input events provided in WPF often come implemented as a tunneling/bubbling pair. Tunneling events are also sometimes referred to as Preview events, because of a naming convention that is used for the pairs.

    For Examples,check the below links:
    http://www.informit.com/articles/article.aspx?p=689111&seqNum=3

    http://www.codeproject.com/KB/WPF/BeginWPF3.aspx

    Thanks -- Vijaya Kadiyala
    http://www.DotNetVJ.com
    Microsoft MVP

  • #266091
    Event Bubbling is nothing but events raised by child controls is handled by the parent control. Example: Suppose consider datagrid as parent control in which there are several child controls.There can be a column of link buttons right.Each link button has click event.Instead of writing event routine for each link button write one routine for parent which will handlde the click events of the child link button events.Parent can know which child actaully triggered the event.That thru arguments passed to event routine
    Regards
    Sridhar R
    Nothing is illegal, Until You Get Caught


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.