Changing Zoom from Code

3 posts, 0 answers
  1. Craig
    Craig avatar
    10 posts
    Member since:
    Mar 2012

    Posted 22 Mar 2012 Link to this post

    I am using the ChartView control, and would like to be able to change the Zoom from code.
    I have tried two things.

    1. Set Zoom property directly from code.
    i.e. Chart.Zoom = new Size(1,1);

    2. Bind to a Zoom property on my view model, and set that property.

    i.e. XAML gets

       <telerik:RadCartesianChart Name="Chart" Zoom="{Binding Path=Zoom, Mode=TwoWay}">

    And code gets
         ViewModel.Zoom = new Size(1,1);

    Either way, the view is not refreshed correctly.  However, on a re-size operation, it becomes OK again.

    Is this a known problem, or is there something else I need to do?

    Thanks
    Craig Littlewood
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 27 Mar 2012 Link to this post

    Hello Craig,

    We assume you are trying to reset the pan/zoom state after the user has applied some pan/zoom actions with the mouse -- you can achieve the desired effect like this:
    private void ResetPanAndZoomState()
    {
        RadChart1.Zoom = new Size(1, 1);
        RadChart1.PanOffset = new Point(0, 0);
    }

    Hope this helps.


    All the best,
    Giuseppe
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Craig
    Craig avatar
    10 posts
    Member since:
    Mar 2012

    Posted 27 Mar 2012 Link to this post

    Giuseppe  

    I can confirm this resolved the problem.

    Thanks and regards
    Craig
Back to Top