ListenerExists Method

AutomationPeer.ListenerExists Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets a value that indicates whether UI Automation is listening for the specified event.

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

Public Shared Function ListenerExists ( _
	eventId As AutomationEvents _
) As Boolean


Type: System.Windows.Automation.Peers.AutomationEvents
One of the enumeration values.

Return Value

Type: System.Boolean
true if UI Automation is listening for the specified event; otherwise, false.

Typically, you call this method before you create the AutomationPeer that raises the event. This method is a performance measure, because if UI Automation is not listening for the event, it does not make sense to create a peer to raise the event.


This method is static. It returns true only if a delegate is listening for the specified event in UI Automation. It does not indicate whether the delegate is listening for an event on a specific object. UI Automation can create broadcast listeners. Therefore, the per-object information is irrelevant.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft