Adding gauge only with code

2 posts, 0 answers
  1. David
    David avatar
    18 posts
    Member since:
    Dec 2010

    Posted 25 Dec 2010 Link to this post

    I'm trying to add a gauge to an existing wrapPanel but I'm doing something wrong. my code is :

    Grid newGrid = new Grid();
    RadGauge newRG =
    new RadGauge();
    LinearGauge newLG = new LinearGauge();
    LinearScale newLS = new LinearScale();
    IndicatorList newIL = new IndicatorList();
    Marker newMarker = new Marker();
     
    newIL.Items.Add(newMarker);
    newLS.Indicators.Add(newIL);
    newLG.Items.Add(newLS);
    newRG.Content = newLG;
    newGrid.Children.Add(newRG);
    GaugesWrapPanle.Children.Add(newGrid);

    The error I get is :
    "Unable to cast object of type 'Telerik.Windows.Controls.Gauges.IndicatorList' to type 'Telerik.Windows.Controls.Gauges.IGaugeIndicator'".

    Could you please write the right way for doing this?

    Thank you
  2. David
    David avatar
    18 posts
    Member since:
    Dec 2010

    Posted 25 Dec 2010 Link to this post

    After wirting it again from the beginning I've got it to work, thx anyway.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top