UIElement.AddToEventRoute(EventRoute, RoutedEventArgs) 方法

定義

針對目前的 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

加入處理常式的事件路由。The event route that handlers are added to.

e
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.

適用於