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

How do I set the ScaleObject.Value property?

1 Answer 63 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 05 Aug 2013, 04:26 PM
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

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 08 Aug 2013, 05:45 AM
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 >>
Tags
Gauge
Asked by
Scott
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or