AutomationEvent::EventRaised Event
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Occurs when the Automation event occurs.
Assembly: System.Windows (in System.Windows.dll)
This event is useful for attaching managed event handlers to Automation events without requiring knowledge of the Automation event signatures. It also enables you to use Automation events with the standard Visual Basic event handling syntax. You can use this event with the AddHandler and RemoveHandler statements. You can also use the Handles keyword after storing the AutomationEvent reference in a variable by using the WithEvents keyword.
Alternately, you can attach managed event handlers directly to Automation events by using the += syntax in C#, and detach them using the -= syntax. You can also use the AddEventHandler method. However, in these cases, the specified delegate must have a signature that exactly matches the Automation event signature.
For more information about Automation, see Automation.
Note: |
|---|
Events with return values are not supported. Additionally, to use C# custom delegates with Automation events that have optional parameters, you must specify default parameter values in the delegate signature. In Visual Basic, delegate parameters cannot be optional, so you must handle the EventRaised event instead. |
Note: