Getting the value of an attached property from a code step

2 posts, 0 answers
  1. Ryan
    Ryan avatar
    1 posts
    Member since:
    Oct 2012

    Posted 07 Dec 2012 Link to this post

    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)")


    Ryan Burt
  2. Cody
    Cody avatar
    3354 posts

    Posted 10 Dec 2012 Link to this post

    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.

    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top