UIElement.OnCreateAutomationPeer Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

When implemented in a derived class, returns class-specific AutomationPeer implementations for the Silverlight automation infrastructure.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)


Protected Overridable Function OnCreateAutomationPeer As AutomationPeer
protected virtual AutomationPeer OnCreateAutomationPeer()

Return Value

Type: System.Windows.Automation.Peers.AutomationPeer
The class-specific AutomationPeer subclass to return.


Classes that participate in the Silverlight automation infrastructure must implement this method to return a class-specific derived class of AutomationPeer that reports information for automation behavior. See UI Automation of a Silverlight Custom Control.

Version Notes

Silverlight for the desktop

 Some events are only available if you are targeting Silverlight for Windows Phone. If you attempt to add handlers for such events to code targeting Silverlight 4, either through explicit AddHandler(RoutedEvent, Delegate, Boolean) calls or by declaring events in XAML, the target runtime throws a NotImplementedException.

Version Information


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.