sergi
7 years agoContributor
How to find a generic ItemsControl in WPF app
I want to find a list in my WPF app that is an ItemsControl view.
In case it is a ListBox instead of ItemsControl I do the following (which works fine):
IDriver driver = new LocalDriver();
IProcess process = localDriver.Find<IProcess>(new ProcessPattern {ProcessName = "MyApp"});
IListBox items = this.process.Find<IListBox>(new WPFPattern { WPFControlAutomationId = "items" }, 10);
But that doesn't work for ItemsControl. I've seen there's IListViewCollection<T> that sounds like something useful but I haven't managed to make it work and the documentation is not useful at all here.
Any suggestion will be much appreciated.