Gauge chart doesn't refresh dynamically ranges

2 posts, 0 answers
  1. Anatoly Chekh
    Anatoly Chekh avatar
    86 posts
    Member since:
    Apr 2010

    Posted 22 May 2012 Link to this post


    I have an issue. I try to change scale ranges dynamically, but it doesn't changed (old range is shown).
    This is simple app where it doesn't work:


                <telerik:RadRadialGauge Width="220" Height="220">
                    <telerik:RadialScale Name="scale" 
                            <telerik:GaugeRange Min="0" Max="20" StartWidth="0.015" EndWidth="0.015" Background="Green"  />
                <Button Content="Click" Click="ButtonBase_OnClick" />

    Click action is very simple:
    private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
         scale.Ranges.Add(new GaugeRange() { Min = 20, Max = 40, StartWidth = 0.015, EndWidth = 0.015, Background = new SolidColorBrush(Colors.Green) });

    After buttin click I see old range from 0 to 20. If I call scale.InvalidateMeasure(); then I get new range from 20 to 40, but also I still see old range from 0 to 20.

    Is is a bug or I'm doing something wrong?

    Thanks, Anatoly Chekh.
  2. Andrey
    Andrey avatar
    1681 posts

    Posted 25 May 2012 Link to this post

    Hello Anatoly,

    We are aware of a problem with Clear method. The problem is in the implementation of this method in the standard DependencyObjectCollection and code in the gauge control which relies on it. We created a fix for this problem already. We extended the collection which implements the IList interface with RemoveAll method which should be used instead of Clear method. Note, the extension is included into the Telerik.Windows.Controls.Map namespace in the same Telerik.Windows.Controls.DataVisualization.dll assembly.
    The sample code is below.
    using System.Windows;
    using System.Windows.Controls;
    using Telerik.Windows.Controls.Gauge;
    using Telerik.Windows.Controls.Map;
    using System.Windows.Media;
    namespace GaugeRangeVisibility
        public partial class MainPage : UserControl
            public MainPage()
            private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
                scale.Ranges.Add(new GaugeRange()
                    Min = 20,
                    Max = 40,
                    StartWidth = 0.015,
                    EndWidth = 0.015,
                    Background = new SolidColorBrush(Colors.Green)

    Kind regards,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top