RecordInit 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 Micro Focus Support.

Registers event handlers.


To hook a control's events, override this method and register your event handlers in one of these ways, or a combination of them:

  • Define and add Event handlers with the IUtilityObject.AddHandler method.

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

    There is no limit to the number of handlers defined this way.

  • Use the syntax: myApplicationObject.ValueChanged += e;

    If you use this syntax, override IRecord.RecordStop to unsubscribe from Event handling.

It is preferable to use AddHandlerrather than the '+=' syntax. If you use AddHandler, UFT automatically removes your handler at the end of the Record session.


Visual Basic (Declaration) 
Overridable Sub RecordInit() 
virtual void RecordInit()

See Also