Getting label from silverlight component

3 posts, 1 answers
  1. Asta
    Asta avatar
    29 posts
    Member since:
    Nov 2011

    Posted 05 Jun 2012 Link to this post

    Is there any ability to get label from silverlight component (let say TreeViewItem) ?
  2. Answer
    Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 05 Jun 2012 Link to this post

    Hello Asta,

    What do you mean exactly by label? A screen shot or public site would help me understand what value you're after.

    If you simply want the text from the underlying TextBlock of a Silverlight element, like a TreeViewItem, use the following code:

    TreeViewItem tv5 = app.Find.ByExpression(new XamlFindExpression("XamlTag=stackpanel", "name=SampleSelectionContainer", "|", "XamlPath=/treeviewitem[0]/grid[0]/itemspresenter[name=ItemsHost]/stackpanel[0]/treeviewitem[5]")).As<TreeViewItem>();
     
    Log.WriteLine(tv5.TextBlockContent);

    If the label you mention is actually a tool-tip, that will be more in-depth. See here for more information.

    All the best,
    Anthony
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Asta
    Asta avatar
    29 posts
    Member since:
    Nov 2011

    Posted 12 Jun 2012 Link to this post

    I mean ToolTipText. You help me to find a solution. Thanks :)
Back to Top