Adds a routed event handler for a specified routed event, adding the handler to the handler collection on the current element. Specify
handledEventsToo as true to have the provided handler be invoked for routed event that had already been marked as handled by another element along the event route.
Syntax
| Visual Basic (Declaration) | |
|---|
Public Sub AddHandler( _
ByVal routedEvent As System.Windows.RoutedEvent, _
ByVal handler As System.Delegate, _
ByVal handledEventsToo As System.Boolean _
) |
Parameters
- routedEvent
- An identifier for the routed event to be handled.
- handler
- A reference to the handler implementation.
- handledEventsToo
- true to register the handler such that it is invoked even when the routed event is marked handled in its event data; false to register the handler with the default condition that it will not be invoked if the routed event is already marked handled. The default is false. Do not routinely ask to rehandle a routed event. For more information, see Remarks.
Exceptions
| Exception | Description |
| System.ArgumentNullException | routedEvent or% handler% is null. |
| System.ArgumentException | routedEvent does not represent a supported routed event.-or-handler does not implement a supported delegate. |
| System.NotImplementedException | Attempted to add handler for an event not supported by the current platform variation. |
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also