Propagation of events in the middle of a WPF route

Source: Internet
Author: User

Routed events (RoutedEvent) is a new event in WPF that is not very different from traditional events,

But the way of transmission is completely different.

How routed events are propagated

Define the way to propagate through routingstrategy

     Public enum RoutingStrategy    {        0// Tunnel, propagated inward by top-level elements, events typically start        with preview 1 // bubbling, contrary to the tunnel, spreading outward        2 // Direct, similar to a traditional event    }

The most common routing events in WPF are tunnel and bubble, so the general routed events are paired,

such as:Previewmouseleftdown and mouseleftdown

Note: The tunnel event is always executed first than the bubble event, and if Handled = True is set in the tunnel event, the paired bubble event will not occur. Because they share an instance of the same RoutedEventArgs class, Handled = True is set during retransmission, the routed event continues to propagate, but it is not executed.

For more detailed information, please refer to:

WPF QuickStart Series (3)--in-depth parsing of the WPF event mechanism

Propagation of events in the middle of a WPF route

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.