Intersoft ClientUI Documentation
AddHandler(DependencyObject,RoutedEvent,Delegate) Method
See Also  Example Send Feedback
Intersoft.Client.Framework Namespace > DependencyObjectExtensions Class > AddHandler Method : AddHandler(DependencyObject,RoutedEvent,Delegate) Method






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.
Adds a routed event handler for a specified routed event, adding the handler to the handler collection on the current element.

Syntax

Visual Basic (Declaration) 
<ExtensionAttribute()>
Public Overloads Shared Sub AddHandler( _
   ByVal element As DependencyObject, _
   ByVal routedEvent As RoutedEvent, _
   ByVal handler As Delegate _
) 
Visual Basic (Usage)Copy Code
Dim element As DependencyObject
Dim routedEvent As RoutedEvent
Dim handler As Delegate
 
DependencyObjectExtensions.AddHandler(element, routedEvent, handler)
C# 
[ExtensionAttribute()]
public static void AddHandler( 
   DependencyObject element,
   RoutedEvent routedEvent,
   Delegate handler
)
Delphi 
public procedure AddHandler( 
    element: DependencyObject;
    routedEvent: RoutedEvent;
    handler: Delegate
); static; 
JScript 
ExtensionAttribute()
public static function AddHandler( 
   element : DependencyObject,
   routedEvent : RoutedEvent,
   handler : Delegate
);
Managed Extensions for C++ 
[ExtensionAttribute()]
public: static void AddHandler( 
   DependencyObject* element,
   RoutedEvent* routedEvent,
   Delegate* handler
) 
C++/CLI 
[ExtensionAttribute()]
public:
static void AddHandler( 
   DependencyObject^ element,
   RoutedEvent^ routedEvent,
   Delegate^ handler
) 

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.

Example

The following shows how to use AddHandler method to handle the Click routed event of a UXButton.
C#Copy Code
void UXPage1_Loaded(object sender, RoutedEventArgs e)
{
    button1.AddHandler(ISButton.ClickEvent, new RoutedEventHandler(button1_Click));
}

void button1_Click(object sender, RoutedEventArgs e)
{
    MessageBox.Show("Button1 Clicked");
}

Remarks

 

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.