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

Getting label from silverlight component

2 Answers 41 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Asta
Top achievements
Rank 1
Asta asked on 05 Jun 2012, 01:27 PM
Is there any ability to get label from silverlight component (let say TreeViewItem) ?

2 Answers, 1 is accepted

Sort by
0
Accepted
Anthony
Telerik team
answered on 05 Jun 2012, 04:36 PM
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
0
Asta
Top achievements
Rank 1
answered on 12 Jun 2012, 02:27 PM
I mean ToolTipText. You help me to find a solution. Thanks :)
Tags
General Discussions
Asked by
Asta
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Asta
Top achievements
Rank 1
Share this question
or