This question is locked. New answers and comments are not allowed.
I have a user control that creates multiple gauges, however when I view the page I can only see one gauge, if I use Silverlight Spy I can see that both the gauges have been created, so I must be doing something wrong! ;
| void drawRadialGauge(DataRow dr) |
| { |
| try |
| { |
| RadialScale scale; |
| Needle needle; |
| StackPanel stackpanel = new StackPanel() |
| { |
| HorizontalAlignment = System.Windows.HorizontalAlignment.Left, |
| VerticalAlignment = System.Windows.VerticalAlignment.Top |
| }; |
| // create the RadGauge |
| RadGauge radGauge = new RadGauge() |
| { |
| Name = String.Format("Gauge_{0}_{1}", dashitem.uniqueid, i.ToString()), |
| Width = 250, |
| Height = 250 |
| }; |
| // add RadGauge to the LayoutRoot |
| stackpanel.Children.Add(radGauge); |
| // create the RadialGauge |
| var gauge = new RadialGauge(); |
| // add RadialGauge to the RadGauge |
| radGauge.Content = gauge; |
| // create the RadialScale |
| scale = new RadialScale() |
| { |
| Name = String.Format("Scale_{0}_{1}", dashitem.uniqueid, i.ToString()), |
| Min = Convert.ToDouble(dashitem.minvalue), |
| Max = Convert.ToDouble(dashitem.maxvalue), |
| EndWidth = 0.1, |
| StartWidth = 0.1, |
| MiddleTicks = 2, |
| MinorTicks = 2, |
| Radius = 0.75d |
| }; |
| // add RadialScale to the RadialGauge |
| gauge.Items.Add(scale); |
| // create the Needle |
| needle = new Needle() |
| { |
| Name = String.Format("Needle_{0}_{1}", dashitem.uniqueid, i.ToString()), |
| IsAnimated = true, |
| Value = Convert.ToDouble(dr[dashitem.yfield]), |
| }; |
| // add needle to indicators collection |
| scale.Indicators.Add(needle); |
| // create the Needle |
| RadialBar bar = new RadialBar() |
| { |
| Name = String.Format("Bar_{0}_{1}", dashitem.uniqueid, i.ToString()), |
| IsAnimated = true, |
| Value = Convert.ToDouble(dr[dashitem.yfield]), |
| }; |
| // add needle to indicators collection |
| scale.Indicators.Add(bar); |
| } |
| LayoutRoot.Children.Add(stackpanel); |