Telerik.Windows.Controls.Gauges.IndicatorBase.MeasureOverride infinite loop problem

3 posts, 0 answers
  1. Erkan Durmaz
    Erkan Durmaz avatar
    2 posts
    Member since:
    Dec 2009

    Posted 03 Aug 2010 Link to this post

    Hi,

    I have a custom ExtendedGauge control derived from RadGauge, which adds a DynamicDictionary dep.property. Server-side sends some data in DynamicDictionary format, and if you databind a DynamicDictionary object to the DynamicDictionary property of ExtendedGauge, it creates a RadialGauge. We added DynamicDictionary property to support MVVM in our pages.

     

    private static void DynamicDictionaryChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)

     

    {

     

        ExtendedGauge extendedGauge = dependencyObject as ExtendedGauge;

     

     

        if (e.NewValue is DynamicDictionary)

     

        {

            extendedGauge.LoadDynamicDictionary();

            extendedGauge.RegisterDynamicDictionaryDataChangedEvent();

        }

    }

    when DynamicDictionary property changes LoadDynamicDictionary method is called, which parses DynamicDictionary values and creates a RadialGauge.

     

     

    private void LoadDynamicDictionary()

     

    {

     

        try

     

        {

            InitWithDefaults();

     

            if (this.DynamicDictionary != null)

     

            {

     

                // parse gauge parameters from the DynamicDictionary

     

                ParseGaugeParams();

            }

     

            // create a new gauge

     

     

            this.Content = CreateRadialGauge();

     

        }

     

        catch { } // ignore exception

     

    }

    CreateRadialGauge method is listed below:

     

     

    private RadialGauge CreateRadialGauge()

     

    {

     

        // Create Needle

     

     

     

     

     

        Needle needle = new Needle();

     

        needle.Name =

    "needle";

     

        needle.Foreground =

    new SolidColorBrush(Colors.Yellow);

     

        needle.Background =

    new SolidColorBrush(Colors.Yellow);

     

        needle.IsAnimated =

    true;

     

        needle.Duration =

    new Duration(TimeSpan.FromSeconds(2));

     

        needle.Value =

    this.value;

     

     


        // Create RadialScale

     

     

     

     

     

        RadialScale radialScale = new RadialScale();

     

        radialScale.Min =

    this.minValue;

     

        radialScale.Max =

    this.maxValue;

     

        radialScale.Indicators.Add(needle);

     

        int sliceCount = this.sliceColors.Count;

     

     

        double sliceLength = (this.maxValue - this.minValue) / sliceCount;

     

     

        
        this
    .sliceColors.ToList().ForEach(slicePair =>

     

        {

            radialScale.Ranges.Add(

    new RadialRange

     

     

     

     

            {

                Min = slicePair.Key * sliceLength,

                Max = (slicePair.Key + 1) * sliceLength,

                StartWidth = 0.05,

                EndWidth = 0.05,

                Background =

    new SolidColorBrush(slicePair.Value)

     

            });

        });

     

        
        // Create RadialGauge

     

     

     

     

     

        RadialGauge radialGauge = new RadialGauge();

     

        radialGauge.Items.Add(radialScale);

     

        return radialGauge;

     

    }

    When I created the RadialGauge and assign it to the content property of the ExtendedGauge (ContentControl), I ran into an infinite loop. Is this a bug in RadGauge or am i doing something wrong?

    Thanks,

    Erkan

    [2010-08-03 10:23:47,802] [ERROR] [10] [88] - System.InvalidOperationException: UIElement.Measure(availableSize) cannot be called with NaN size.
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at Telerik.Windows.Controls.Gauges.IndicatorBase.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at Telerik.Windows.Controls.Gauges.IndicatorBase.Telerik.Windows.Controls.Gauges.IGaugeIndicator.Measure(Size )
       at Telerik.Windows.Controls.Gauges.IndicatorList.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Canvas.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at Telerik.Windows.Controls.Gauges.RangedControl.MeasureOverride(Size availableSize)
       at Telerik.Windows.Controls.Gauges.RadialScale.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at Telerik.Windows.Controls.Gauges.GaugeBase.MeasureOverride(Size availableSize)
       at Telerik.Windows.Controls.Gauges.RadialGauge.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Page.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
       at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
       at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Window.MeasureOverrideHelper(Size constraint)
       at System.Windows.Window.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.UIElement.UpdateLayout()
       at System.Windows.Interop.HwndSource.SetLayoutSize()
       at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
       at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
       at System.Windows.Window.SetRootVisual()
       at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
       at System.Windows.Window.CreateSourceWindowImpl()
       at System.Windows.Window.SafeCreateWindow()
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Window.Show()
       at System.Windows.Window.ShowDialog()
       at Telerik.Windows.Controls.RadWindowPopup.WindowPopupWindowFactory.WindowPopupWindowImpl.OpenPopup()
       at Telerik.Windows.Controls.RadWindowPopup.WindowPopup.Open(Boolean isModal)
       at Telerik.Windows.Controls.RadWindow.ShowWindow(Boolean modal)
       at Telerik.Windows.Controls.RadWindow.ShowDialog()
       at Telerik.Windows.Controls.RadWindow.ConfigureModal(RadAlert content, DialogParameters dialogParams)
       at Telerik.Windows.Controls.RadWindow.Alert(DialogParameters dialogParameters)
       at Utility.Mvvm.MessageBoxUtility.ShowAlertDialog(String content, Window ownerWindow) 

  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 03 Aug 2010 Link to this post

    Hi Erkan Durmaz,

    We tried to reproduce the problem using your code, but we failed. Could you, please, send to us a small solution which reproduces this problem?

    Sincerely yours,
    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Erkan Durmaz
    Erkan Durmaz avatar
    2 posts
    Member since:
    Dec 2009

    Posted 13 Aug 2010 Link to this post

    Hi Andrey,

    I think problem occurs when radialScale.Max value is 0. I fixed the problem by assigning a default value if max value and actual values are 0.

    Erkan

Back to Top