Intersoft ClientUI Documentation
AddHandler(DependencyObject,RoutedEvent,Delegate,Boolean) Method
Example 



The UIElement of which routed event to be handled.
An identifier for the routed event to be handled.
A reference to the handler implementation.
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
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
<ExtensionAttribute()>
Public Overloads Shared Sub AddHandler( _
   ByVal element As DependencyObject, _
   ByVal routedEvent As RoutedEvent, _
   ByVal handler As Delegate, _
   ByVal handlesToo As Boolean _
) 
Dim element As DependencyObject
Dim routedEvent As RoutedEvent
Dim handler As Delegate
Dim handlesToo As Boolean
 
DependencyObjectExtensions.AddHandler(element, routedEvent, handler, handlesToo)
[ExtensionAttribute()]
public static void AddHandler( 
   DependencyObject element,
   RoutedEvent routedEvent,
   Delegate handler,
   bool handlesToo
)
[ExtensionAttribute()]
public:
static void AddHandler( 
   DependencyObject^ element,
   RoutedEvent^ routedEvent,
   Delegate^ handler,
   bool handlesToo
) 

Parameters

element
The UIElement of which routed event to be handled.
routedEvent
An identifier for the routed event to be handled.
handler
A reference to the handler implementation.
handlesToo
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
Example
The following example shows how to handle a routed event that is invoked regardless of the Handled value in the event data.
void UXPage1_Loaded(object sender, RoutedEventArgs e)
{
    button1.AddHandler(ISButton.ClickEvent, new RoutedEventHandler(button1_Click), true);
}

void button1_Click(object sender, RoutedEventArgs e)
{
    MessageBox.Show("Button1 Clicked");
}
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

Reference

DependencyObjectExtensions Class
DependencyObjectExtensions Members
Overload List

Concepts

Routed Events Overview

Tasks

Routed Events How-to Topics

Send Feedback