AddHandler Method

UFT One 2022 and later: Following the discontinuance of the Silverlight development framework, UFT One no longer supports the Silverlight Add-in out of the box.

If you need to use and extend the Silverlight Add-in, contact OpenText Support.

Adds an event handler.

Remarks

Handlers added with this method are released by the UFT infrastructure.

Syntax

Visual Basic (Declaration) 
Overridable Sub AddHandler( _
   ByVal element As UIElement, _
   ByVal eventName As String, _
   ByVal handler As MulticastDelegate _
) 
C# 
virtual void AddHandler( 
   UIElement element,
   string eventName,
   MulticastDelegate handler
)

Parameters

element
The control on which to add the event handler. This is generally the IUtilityObject.ApplicationObject but may be a child control or any other control.
eventName

The name of the event to handle, for example "SelectedDatesChanged" for the SelectedDatesChanged event on a calendar.

handler
The event handler.

Example

C#Copy Code
private RoutedEventHandler _hExpanded; 
 
RecordInit() 

                _hExpanded = new RoutedEventHandler(OnExpanded); 
                UtilityObject.AddHandler(UtilityObject.ApplicationObject as UIElement, "Expanded", hExpanded); 

 
private void OnExpanded(object sender, RoutedEventArgs arg) 

}

See Also