UIElement.AddToEventRoute(EventRoute, RoutedEventArgs) 方法

定義

針對目前的 EventRoute 事件處理常式集合,將處理常式加入至指定的 UIElement

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

加入處理常式的事件路由。

e
RoutedEventArgs

用於加入處理常式的事件資料。 這個方法會使用事件資料的 RoutedEvent 屬性來建立處理常式。

備註

這個方法可由內容主元素使用, (實 IContentHost 作的元素,或是未) 的元素,將子專案的處理常式新增至 EventRoute 。 一般而言,不需要這樣做 UIElement ,因為處理常式會自動新增至已完成邏輯樹狀結構中找到的所有元素。 不過,在某些情況下 ContentElement ,範本化樹狀結構中有 和 UIElement 混合,需要將來自範本的中間元素新增至路由。 和 UIElementContentElement 支援這個方法的版本。

適用於