Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
XamZoomBar Range property binding UpdateSourceTrigger=PropertyChanged
posted

I am trying to update some of my UI elements instantly when user moves with the XamZoomBar. I've binded to the Range property. The binding is working just not instantly, I mean the property is updated only when the user finishes the operation (end of move, mouse up). I would like to have updated with all values, and display these value _during_ the user moves the zoombar. I've tried using UpdateSourceTrigger=PropertyChanged with no success.

Thx in advance

  • 115
    Suggested Answer
    Offline posted

    Justin, the way I achieved this was to use the ZoomChanged and ZoomChanging event. 

    Code looks something like this. I did this to make the zoom on the chart instant.:

    private void XamZoombar_ZoomChanged(object sender, ZoomChangedEventArgs e)
            {
                HandleXamZoombarZoom(e.NewRange);
            }
     
            private void XamZoombar_ZoomChanging(object sender, ZoomChangeEventArgs e)
            {
                HandleXamZoombarZoom(e.NewRange);
            }
     
     
            void XamDataChart_WindowRectChanged(object sender, Infragistics.RectChangedEventArgs e)
            {
                if (IsZoombarChanging) return;
                if (this.price_xamZoomBar == null) return;
                XamZoombar xamZoomBar = this.price_xamZoomBar;
                try
                {
                    IsZoombarChanging = true;
                    Range newZoombarRange = new Range
                    {
                        Minimum = e.NewRect.X,
                        Maximum = e.NewRect.X + e.NewRect.Width
                    };
                    
                    xamZoomBar.Range = newZoombarRange;                
                }
                finally
                {
                    IsZoombarChanging = false;
                }
            }
     
            bool IsZoombarChanging = false;
     
            private void HandleXamZoombarZoom(Range zoombarRange)
            {
                if (this.price_XamDataChart == nullreturn;
                XamDataChart xamDataChart = this.price_XamDataChart;
     
     
                if (IsZoombarChanging) return;
                try
                {
                    IsZoombarChanging = true;                
                    xamDataChart.WindowRect = new Rect
                    {
                        Y = 0,
                        Height = 1,
                        X = zoombarRange.Minimum,
                        Width = (zoombarRange.Maximum - zoombarRange.Minimum)
                    };
                }
                finally
                {
                    IsZoombarChanging = false;
                }
            }

  • 12875
    posted

    Hi Justin,

     

    You are correct the bound range value is not updated until the XamZoombar move has completed.  The values you are looking for are passed in the ZoomChanging event arguments.