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

Getting the value of an attached property from a code step

1 Answer 80 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 07 Dec 2012, 06:42 PM
I am trying to get the value of an attached property using the telerik test studio express with wpf test. I have access to the dlls that are used by the application so I want to try and script a few things in the test using the applications dlls. How would I go about getting the value of an attached property in code either by using the automation objects provided by telerik, or by getting actual objects from the visual tree. (e.g. System.Windows.DepenendcyObject) and then writing code using the application dlls. (e.g. "depObj.GetValue(WindowScope.WindowId)")

Thanks,

Ryan Burt

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 10 Dec 2012, 10:41 PM
Hello Ryan,

It turns out there's a very easy way to fetch attached properties. You can use our GetAttachedProperty API method. As an example, let's say you want to fetch the Bouyancy property as given in this MSDN article. You would use code like this:

Bouyancy mypropvalue = elem.GetAttachedProperty<Bouyancy>("AquariumObject3", "Bouyancy");

We need to add a working code sample of this to our online code samples for all of our customers.

Greetings,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Ryan
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or