This is a migrated thread and some comments may be shown as answers.

How to get all the Framework element recursively

3 Answers 131 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kiran
Top achievements
Rank 2
Kiran asked on 24 Jul 2010, 09:16 AM
Hi,

I am using WebAii 2.0 for automating silverlight 3 application.

I need to get all the types in a control through Find . Also it should recursively check the children aslo.

I tried the below but i got nothing

IList

<FrameworkElement> elmnts = grid.Find.AllByType<FrameworkElement>();

I neded this if i am automating any customUserControl which was developed by someone else and i dont know anything about the controls used in that.
So i need to know all the elements in that control.

Also can you suggest some tools to see the visual tree like UISpy.

 


Thanks
Kiran

3 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 24 Jul 2010, 09:52 PM
Hi Kiran,

Getting no elements with type FrameworkElement is expected. This is the generic type in WebAii for Silverlight (and Silverlight itself actually, although the namespace differs) and all the elements inherit from this type.

The two good tools including Silverlight Visual Tree inspectors I'm aware of are WebUI Test Studio (with our DOM Explorer) and Silverlight Spy. Both are paid but have evaluation copy/trial period. You can see the test studio's DOM Explorer in action in this video.

Kind regards,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kiran
Top achievements
Rank 2
answered on 30 Jul 2010, 08:37 PM
Hi Petkov,

Is there any dirty mechanism by which i could get all the Framework element inside a Control/UserControl etc through code.

Thanks
Kiran
0
Konstantin Petkov
Telerik team
answered on 02 Aug 2010, 10:17 AM
Hi Kiran,

You can try with the FrameworkElement.Children collection. You can write a utility method to check recursively for all the elements within the given one and add the inner result into a List for example. The (.Children.Count > 0) check can tell you whether the method should be called for the inner element or you can proceed with the next element on the same level.

Greetings,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Kiran
Top achievements
Rank 2
Answers by
Konstantin Petkov
Telerik team
Kiran
Top achievements
Rank 2
Share this question
or