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

Need to add Gauge Range List from Viewmodel

0 Answers 40 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Muthukumar asked on 11 Sep 2012, 08:44 AM
hi team,
i have Rad gauge within a listbox so that i can add the number of gauges dynamically. since i am using MVVM pattern for my project, i should have all my properties and populate them in ViewModel.
now i am creating a class which is having all the properties of gauge and add the gauge object to list then set the list as itemssource for that created list box. here i have a big challenge that i need to add the range list dynamically if i have them static it is working good 
but i need to have them as dynamic for eg one gauge will have 2 ranges and another one will have 4 ranges. 
how could i add these rangelist dynamically from viewmodel. please give me a sample code in mvvm.

Muthukumar Nagarajan 
<Grid x:Name="LayoutRoot" Background="White">
        <ListBox ItemsSource="{Binding GaugeList}" >
                    <StackPanel Orientation="{Binding View}"></StackPanel>
                    <telerik:RadGauge Width="280"
                                            x:Name="rdg" Cursor="Hand" FontFamily="Calibri" FontSize="13.333">
                        <telerik:RadGauge x:Name="RadialGauge1"
                                                IsEnabled="{Binding IsGaugeEnabled}"
                                                Tag="1" Cursor="Hand">
                                                    Style="{StaticResource NewGaugeStyle}"
                                                    x:Name="RadialGauge1VR" >
                                                        Style="{StaticResource RadialScaleHalfCircleNStyle}"
                                                        Min="{Binding Min}" Max="{Binding Max}"
                                                        MajorTickStep="{Binding MajorTickStep}"
                                                        x:Name="RadialScale1" Radius="1.6" EndWidth="0.4" StartWidth="0.4" StartAngle="181" SweepAngle="177" MiddleTicks="5" MinorTicks="2">                                   
                                        <telerik:MiddleTickProperties Background="White" Location="CenterOutside" Length="0.12" TickWidth="0.08"/>
                                        <telerik:LabelProperties Format="{}{0:F1}" Location="CenterInside" FontSize="16" Offset="0.25" />
                                                                Background="White" Offset="-0.15" TickWidth="0.05" />
                                    <telerik:RangeList FontWeight="Normal">
                                                                Min="{Binding Min}" Max="{Binding Max1}" Background="Transparent" />
                                                                Min="{Binding Max1}" Max="{Binding Max2}" Background="Transparent" />
                                                                Min="{Binding Max2}" Max="{Binding Max3}" Background="Transparent" />                                      
                                    <telerik:IndicatorList HorizontalAlignment="Center">
                                                                Value="{Binding FirstNeedleValue}"
                                                                HorizontalAlignment="Stretch" Style="{StaticResource NewNeedleStyle}" Location="CenterInside" RelativeShift="0" Offset="0.1" RelativeHeight="0.2" RelativeWidth="0"/>

No answers yet. Maybe you can help?

General Discussions
Asked by
Top achievements
Rank 1
Share this question