Find TextBlock element within a huge tree

Feb 18, 2009 at 11:12 AM
Does anybody tryied to get a TextBlock element. If som please send a sample. I'm with a problem that I can't find a TextBlock element with a huge WPF tree of elements. This TextBlock element is inside Content element and a Grid control.

With UISpy I can't get the controls, the only application that shows the tree elements is Snoop (Great tool).

How can I get som help to discover the problem?
Feb 18, 2009 at 1:33 PM
Could it be the problem that this article discuss:

Have someone found the same situation?
Feb 18, 2009 at 4:35 PM
I've done this trick:

1) Put this block of code on my test
2) Set the mouse position where I want to get the control



System.Windows.Point point1 = new System.Windows.Point(System.Windows.Forms.Control.MousePosition.X, System.Windows.Forms.Control.MousePosition.Y);
AutomationElement element1 = AutomationElement.FromPoint(point1);

3) I Get alwasy the content object, not the Button or the TextBlock element I'm looking for.