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 執行階段事件的事件處理常式。 相反地,您應該使用特定的事件處理常式取消hooking 語法:

  • -= 在 C 中#
  • Microsoft Visual Basic 中的RemoveHandler
  • -= 在 Visual C++ 元件延伸模組中, (C++/CX)

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

這個方法會忽略在最初附加處理常式的AddHandler呼叫中handledEventsToo參數是否為 true

適用於

另請參閱