How to add the following items to a RadialGaugeRange by code (during runtime)?:
-SegmentedRadialGaugeIndicator
-ArrowGaugeIndicator
-DataTemplate
I have trie dout this code but it does not work:
RadialGaugeRange rgr = new RadialGaugeRange();
rgr.MinAngle = -75;
rgr.MaxAngle = 255;
rgr.TickStep=100;
rgr.MajorTickStep=150;
rgr.LabelStep=100;
rgr.LabelRadiusScale = 0.95;
rgr.TickRadiusScale = 0.75;
rgr.HorizontalAlignment=System.Windows.HorizontalAlignment.Center;
rgr.VerticalAlignment=System.Windows.VerticalAlignment.Center;
ArrowGaugeIndicator arrow = new ArrowGaugeIndicator();
arrow.ArrowThickness = 2;
arrow.ArrowTailRadius = 1.4;
//arrow.ArrowColor = Colors.Yellow;
arrow.Value = g.Kpi.Value;
rgr.Indicators.Add(arrow);
RadialGaugeRange rangeArrow = new RadialGaugeRange();
rangeArrow.MinAngle = 180;
rangeArrow.MaxAngle = 360;
//RadialGaugeRange.IndicatorRadiusScaleProperty = 0.31;
rgr.Children.Add(rangeArrow);
SegmentedRadialGaugeIndicator ind = new SegmentedRadialGaugeIndicator();
BarIndicatorSegment seg1=new BarIndicatorSegment();
seg1.Length=2;
seg1.Thickness=3;
BarIndicatorSegment seg2 = new BarIndicatorSegment();
seg2.Length = 1.66;
seg2.Thickness = 3;
BarIndicatorSegment seg3 = new BarIndicatorSegment();
seg3.Length = 2.34;
seg3.Thickness = 3;
ind.Segments.Add(seg1);
ind.Segments.Add(seg2);
ind.Segments.Add(seg3);
rgr.Children.Add(ind);
Grid.SetRow(rgr, 1);
Grid.SetColumn(rgr, 0);
newGrid.Children.Add(rgr);
arrow.ArrowColor = Colors.Yellow;
RadialGaugeRange.IndicatorRadiusScaleProperty = 0.31;
Thank you,
Javier Andrés Cáceres Alvis
Windows Phone - MVP
@jacace