EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

UIElement.RemoveHandler method

Applies to Windows and Windows Phone

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

Syntax


public void RemoveHandler(
  RoutedEvent routedEvent, 
  object handler
)

Parameters

routedEvent

Type: RoutedEvent

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

handler

Type: System.Object [.NET] | Platform::Object [C++]

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.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

AddHandler
UIElement
Events and routed events overview
RoutedEvent

 

 

Mostrar:
© 2014 Microsoft. Todos os direitos reservados.