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

Create a RadVerticalLinearGauge in runtime

1 Answer 86 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Diego Alejandro
Top achievements
Rank 1
Diego Alejandro asked on 22 Mar 2012, 06:11 PM
Hello,

I'm trying to create a RadVerticalLinearGauge in runtime, I've made it but I cannot set the properties for NumericIndicator such as telerik:ScaleObject.RelativeWeight. How can I do this?

This is what I want to do:

<telerik:NumericIndicator Format="{}{0:F0}"
                            Value="60"
                            telerik:ScaleObject.RelativeWidth="0.4"
                            telerik:ScaleObject.RelativeHeight="0.1"
                            telerik:ScaleObject.RelativeX="0.6"
                            telerik:ScaleObject.RelativeY="0.1">
                        <telerik:NumericIndicator.Positions>
                            <telerik:SevenSegsNumberPosition />
                            <telerik:SevenSegsNumberPosition />
                            <telerik:SevenSegsNumberPosition />
                        </telerik:NumericIndicator.Positions>
                    </telerik:NumericIndicator>

And, this is my code:
RadVerticalLinearGauge radVertical = new RadVerticalLinearGauge();
 
LinearScale linearScale = new LinearScale();
linearScale.Min = 0;
linearScale.Max = 100;
linearScale.LabelLocation = ScaleObjectLocation.Outside;
                     
radVertical.Items.Add(linearScale);
 
BarIndicator barIndicator = new BarIndicator();
barIndicator.Name = "gaugeIndicator";
barIndicator.Value = 50;
                     
NumericIndicator numericIndicator = new NumericIndicator();
numericIndicator.Format = "{}{0:F0}";
numericIndicator.Value = 60;
 
/*I WANT TO ADD THE SCALEOBJECT PROPERTIES HERE FOR numericIndicator*/
 
linearScale.Indicators.Add(numericIndicator);
linearScale.Indicators.Add(barIndicator);
                     
Border verticalBorder = new Border();
verticalBorder.BorderThickness = new Thickness(1,0,0,0);
verticalBorder.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 51, 102, 153));
                     
 
linearScale.CustomItems.Add(verticalBorder);

I've found this thread: http://www.telerik.com/community/forums/silverlight/gauge/numberindicator.aspx, it is using an oldest release (Q1 2010). I need the same thing using a newer version. I have version 2011.3.1220.1040.

 If anyone can help me, I'll be very thankful.

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 27 Mar 2012, 08:16 AM
Hello Diego Alejandro,

All these properties are attachable dependency properties, so you can set them from code behind using standard Silverlight approach with ScaleObject.SetPropertyName methods. For example, to set ScaleObject.RelativeWidth property you can use the following call:

ScaleObject.SetRelativeWidth(numericIndicator, 0.4);


All the best,
Andrey Murzov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Gauge
Asked by
Diego Alejandro
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or