How do I set the ScaleObject.Value property?

2 posts, 0 answers
  1. Scott
    Scott avatar
    13 posts
    Member since:
    Jul 2012

    Posted 05 Aug 2013 Link to this post

    Hello,

    In the first look on-line demo of the Gauge, you create a custom item like this:

    <Path Style="{StaticResource CustomPin}"
                                   telerik:ScaleObject.Value="200"
                                   Data="M2.5,1 C1.7,1 1,1.7 1,2.5 C1,3.3 1.7,4 2.5,4 C3.3,4 4,3.3 4,2.5 C4,1.7 3,1 2.5,1 z M2.5,0 C4,0 5,1 5,2.5 C5,3.7 4.1,4.7 3,5 L3,5 L3,10 L2,10 L2,5 L2,5 C0.9,4.7 0,3.7 0,2.5 C0,1 1,0 2.5,0 z"/>

    How can I set the ScaleObject.Value property via code instead of XAML?

    I tried giving the PATH a name, but couldn't access the Value. Then tried setting it this way:
    ThePath.SetValue(ScaleObject.ValueProperty,  40);

    But received a run time error that said it was that: '40' is not a valid value for property 'Value'.

    Any help would be appreciated,

    Scott
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 08 Aug 2013 Link to this post

    Hi Scott,

    The ScaleObject.ValueProperty has a double type. So, you must use the value of this type when you use the SetValue method like to the following way:
    ThePath.SetValue(ScaleObject.ValueProperty,  40d);

    But more correct way is in using the ScaleObject.SetValue method, because its value parameter is double. So, the converting of type will be performed automatically. The sample code is below.
    ScaleObject.SetValue(ThePath, 40);

    Regards,
    Andrey Murzov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top