Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 2.09 KB

uielement_removehandler_661998757.md

File metadata and controls

43 lines (28 loc) · 2.09 KB
-api-id -api-type
M:Windows.UI.Xaml.UIElement.RemoveHandler(Windows.UI.Xaml.RoutedEvent,System.Object)
winrt method

Windows.UI.Xaml.UIElement.RemoveHandler

-description

Removes the specified routed event handler from this UIElement. Typically the handler in question was added by AddHandler.

-parameters

-param routedEvent

The identifier of the routed event for which the handler is attached.

-param handler

The specific handler implementation to remove from the event handler collection on this UIElement.

-remarks

RemoveHandler can only be used for the event handlers of the events that are supported by AddHandler, which is approximately the input-specific events of UIElement. More precisely, the event must have a *Event property of type RoutedEvent, which is true only of certain events on UIElement. You cannot use RemoveHandler to unhook event handlers for Windows Runtime events on runtime class instances in general. Instead, you should use the specific event handler unhooking syntax:

  • -= in C#
  • RemoveHandler in Microsoft Visual Basic
  • -= in Visual C++ component extensions (C++/CX)

Calling this method has no effect if there were no handlers registered with criteria that match the input parameters for the method call.

This method ignores whether handledEventsToo parameter was true in the AddHandler call that originally attached the handler.

-examples

-see-also

AddHandler, Events and routed events overview, RoutedEvent