I'm trying to find the screen rectangle that corresponds to the tabs that get created in a dock area when the ChildPaneStyle is set to be a TabGroup. I'm working on a automation tool that builds upon CodedUI with some custom code. We have been able to simulator every control in our app except the tabs that get created by UltraDocManager. I've tried setting IsSelectedTab = true, but this doesn't work. I'd like to send a mouse click to the area on the screen when the tab exists.
I've tried following the hierarchy for tab elements as mention here but I can't get to TabGroupUIElement:
http://ko.infragistics.com/community/forums/t/87863.aspx
I can get to UnPinnedTabAreaUIElement but no further down in that hierarchy. So, how do I get to the Rect that represents a tab created by UltraDocManager?
Thanks,
Don
Hello Don,
Since the Tabs themselves are not part of the controls and coinside with the Panes and we know which UIElement to use; one way of getting at the Rect of the TabGroupUIElement would be to use the DockManager's MouseEnterElement and inspect the details there.
eg.
private void ultraDockManager1_MouseEnterElement(object sender, UIElementEventArgs e) { TabGroupUIElement tabGoupElement = e.Element.GetDescendant(typeof(TabGroupUIElement)) as TabGroupUIElement; if (tabGoupElement != null) { Rectangle tabRect = tabGoupElement.Rect; MessageBox.Show(tabRect.X.ToString() + " " + tabRect.Y.ToString() + " " + tabRect.Width.ToString() + " " + tabRect.Height.ToString()); return; } }
But I haven't been able to determine a viable way to send a mouse click to that Rect/UIElement to achieve your requirement. Let me know if you have any questions regarding this matter.
How can I get to TabGroupUIElement without using the MouseEnterElement event? Since this is for test automation I can't actually use the mouse event. Is there a way to get to TabGroupUIElement using the UltraDocManager? I've tried using the code below but tabGroupElement1 is being set to null:
UnpinnedTabAreaUIElement theTabArea = new UnpinnedTabAreaUIElement(_frmDummyAppUnpinnedTabAreaBottom,ultraDockManager1);
TabGroupUIElement tabGoupElement1 = theTabArea.GetDescendant(typeof(TabGroupUIElement)) as TabGroupUIElement;
I did use your code in a test app and I was able to get to the TabItemUIElement that I wanted to select. Using a little bit of math using tab row counts, tab width, tab height, etc, I should be able to find where to send a hardware level click event. I just need to be able to get TabGroupUIElement from either the UltraDocManager or the UnpinnedTabArea.