UIElement.RemoveHandler(RoutedEvent, Object) 方法

定義

從這個 UIElement移除指定的路由事件處理常式。 一般而言,有問題的處理常式是由 AddHandler所新增。

public:
 virtual void RemoveHandler(RoutedEvent ^ routedEvent, Platform::Object ^ handler) = RemoveHandler;
void RemoveHandler(RoutedEvent const& routedEvent, IInspectable const& handler);
public void RemoveHandler(RoutedEvent routedEvent, object handler);
function removeHandler(routedEvent, handler)
Public Sub RemoveHandler (routedEvent As RoutedEvent, handler As Object)

參數

routedEvent
RoutedEvent

要附加處理常式之路由事件的識別項。

handler
Object

Platform::Object

IInspectable

要從這個 UIElement上的事件處理常式集合中移除的特定處理常式實作。

備註

RemoveHandler 只能用於 AddHandler所支援之事件的事件處理常式,也就是 UIElement的輸入特定事件。 更精確地說,事件必須具有RoutedEvent類型的 *Event屬性,這僅適用于 上的 UIElement 特定事件。 一般情況下,您無法針對 RemoveHandler 執行時間類別實例上的Windows 執行階段事件解除hook 事件處理常式。 相反地,您應該使用 C# 事件處理常式取消hooking 語法: -=

如果沒有使用符合方法呼叫之輸入參數的準則註冊處理常式,則呼叫這個方法沒有任何作用。

這個方法會忽略參數是否 handledEventsTootrue 原本附加處理常式的 AddHandler 呼叫中。

適用於

另請參閱