Slider + Zoom.Width + RadCartesianChart

2 posts, 0 answers
  1. Kyle
    Kyle avatar
    10 posts
    Member since:
    Dec 2013

    Posted 22 Oct 2015 Link to this post

    I have a Slider control bound (TwoWay) to the Zoom.Width property of a RadCartesianChart control.  When I zoom in and out with the scrollwheel on my mouse, the Slider automatically changes (as it should).  But when I try to use the slider to zoom thechart in and out, nothing happens.  The slider won't move.  Is there something I am missing?


    <Slider Name="Slider"
        Value="{Binding ElementName=Chart, Path=Zoom.Width, Mode=TwoWay}"/>
    <telerik:RadCartesianChart Name="Chart"
        Palette="{Binding ChartPalette}"
        HorizontalZoomRangeStart="{Binding HorizontalZoomRangeStart, Mode=TwoWay}"
        HorizontalZoomRangeEnd="{Binding HorizontalZoomRangeEnd, Mode=TwoWay}">
  2. Peshito
    Peshito avatar
    493 posts

    Posted 27 Oct 2015 Link to this post

    Hi Kyle,

    The Zoom property of the chart is of type Size which is a struct. This means that your binding gets a copy of struct since structs are passed by value to methods. In order to get the slider changing zoom's width of the chart attach to slider's ValueChanged event of the slider and update the WIdth and Height of the zoom.

    For instance:
    private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        Chart.Zoom = new Size()
            Width = this.Slider.Value,
            Height = this.Chart.Zoom.Height
    You can further customize the method and update the PanOffset as well.

    Hope this helps.

    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 Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top