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

定義

針對目前的 EventRoute 事件處理常式集合,將處理常式加入至指定的 UIElementAdds 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或未) 新增為子項目,以處理常式EventRouteThis 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. 不過,在某些情況下所在ContentElementUIElement混合樣板化樹狀結構,中間是來自範本必須新增至路由的項目中。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.

適用於