Search code examples
c#event-handlingmicrosoft-ui-automation

How to detect AutomationElement name change


I am using UI Automation in a C# program. I have managed to acquire an element using its Automation ID. However, it exposes no patterns. Using UI Spy, I can see the text I want under Identification->Name. However, when I try to register an event to detect a change of text, nothing happens; the event handler does not get called.

UI Spy doesn't show any ControlPatterns. Does this mean I must manually poll for changes to the element's "name" or is there another way to do this?


Solution

  • You'll have to implement this kind of event yourself, by manually polling the Name property, or rather continuously calling FindFirst with the old name, until it returns no result.