UIElement.AddToEventRoute(EventRoute, RoutedEventArgs) UIElement.AddToEventRoute(EventRoute, RoutedEventArgs) UIElement.AddToEventRoute(EventRoute, RoutedEventArgs) UIElement.AddToEventRoute(EventRoute, RoutedEventArgs) Method

定义

将处理程序添加到当前 EventRoute 事件处理程序集合的指定 UIElement 中。Adds handlers to the specified EventRoute for the current UIElement event handler collection.

public:
 void AddToEventRoute(System::Windows::EventRoute ^ route, System::Windows::RoutedEventArgs ^ e);
public void AddToEventRoute (System.Windows.EventRoute route, System.Windows.RoutedEventArgs e);
member this.AddToEventRoute : System.Windows.EventRoute * System.Windows.RoutedEventArgs -> unit
Public Sub AddToEventRoute (route As EventRoute, e As RoutedEventArgs)

参数

route
EventRoute EventRoute EventRoute EventRoute

要向其添加处理程序的事件路由。The event route that handlers are added to.

e
RoutedEventArgs RoutedEventArgs RoutedEventArgs RoutedEventArgs

用于添加处理程序的事件数据。The event data that is used to add the handlers. 此方法使用事件数据的 RoutedEvent 属性创建处理程序。This method uses the RoutedEvent property of the event data to create the handlers.

注解

此方法可由内容宿主元素 (实现IContentHost的或不是的元素) 用于将子元素的处理程序添加EventRoute到。This method can be used by content host elements (either those that implement IContentHost or those that don't) to add handlers for child elements to the EventRoute. 通常情况下, 这并不UIElement是必需的, 因为对已完成的逻辑树中的所有元素自动添加了处理程序。Ordinarily, this is not required for UIElement, because handlers are automatically added for all elements found in a completed logical tree. 但是, 在某些情况下ContentElement , UIElement在模板树中混合使用和时, 需要将来自模板的干预元素添加到路由。However, in some cases where ContentElement and UIElement are mixed in templated trees, intervening elements that came from the template need to be added to a route. ContentElementUIElement都支持此方法的版本。Both ContentElement and UIElement support a version of this method.

适用于