How to get all the Framework element recursively

4 posts, 0 answers
  1. Kiran
    Kiran avatar
    56 posts
    Member since:
    Dec 2008

    Posted 24 Jul 2010 Link to this post

    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
  2. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 24 Jul 2010 Link to this post

    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
  3. Kiran
    Kiran avatar
    56 posts
    Member since:
    Dec 2008

    Posted 30 Jul 2010 Link to this post

    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
  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 02 Aug 2010 Link to this post

    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
Back to Top