I have a TabControl with multiple TabItems. These TabItems have multiple controls in them but I see no way to obtain a reference to them.
I am able to get references to the White TabPage objects that represent the TabItems for the TabControl, however the TabPage object doesn't give me access to it's child controls. This means that all of the buttons,textboxes etc inside of the TabItem
can't be accessed.
UISpy and VisualUIAVerify can't find any of these nested controls either.
window.GetMultiple(SearchCriteria.All); is also unable to get a reference to these controls.
Based on the documentation at http://msdn.microsoft.com/en-us/library/ms751611.aspx I should be able to navigate child controls it seems like.
I tried the following code to try
ITabPage selected = tabs.SelectedTab; //this returns valid reference
AutomationElement elementNode = TreeWalker.ControlViewWalker.GetFirstChild(selected.AutomationElement); //elementNode is null
elementNode = TreeWalker.ContentViewWalker.GetFirstChild(selected.AutomationElement);//elementNode is null
The treewalkers in both cases however return null. Is this issue because a TabItem doesn't follow the same pattern as other containers in that it has a Content property of type object. So the type might be Text,Image or a Pane. So in order
to obtain references to the child elements you would need to check the type of the Content property and handle that on a case by case basis? Is there a way to actually get a reference to the actual TabItem.Content property? I see no other way to get
the child items in a TabItem.