After digging a bit into this issue, I found a semi-solution. I looked at how the UIMap
designer files generate their code for a ListView
(I adjusted the code a bit for my own variables):
var itemscontrol = new WpfList(window);
itemscontrol.SearchProperties[WpfList.PropertyNames.AutomationId] = "CustomersItemsControl";
itemscontrol.WindowTitles.Add("MainWindow");
var count = itemscontrol.Items.Count(); // Returns the correct value!
I copied this code and it seems to work for an ItemsControl
as well, at least some properties do, such as WpfList.Items
. So, it's a partial solution I guess.