ChartView: Zoom And PanOffset Binding

2 posts, 0 answers
  1. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 27 May 2014 Link to this post

    Hello. I found a good example for Zoom And PanOffset Binding in you samples for WPF (called Zooming and Scrolling)

    It workes fine if the 2 RadCartesianChart located on the same control and binding the same properties. In my project  I have to create a 2 tabs and put custom user control insite the each tab.

    When I select the firs tab i have to change zoom and offset base on the chartView on the second tab.The same for the first tab, it should change properties base on the chart from tab 1. But it doesn't do it correct. It only works if i select the first tab and then select the second tab and change zoom, it will change it everywhere. 

    How can i update zoom on the second chart without opening the tab?

    I put some small example on the git and i guess it will clarified the situation. https://github.com/Magnona/ChartViewZoomPanOffset
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 30 May 2014 Link to this post

    Hi,

    The reason behind the reported issue is the fact that your business PanOffset and Zoom properties are defined in the context of the GraphControl. This means that when you create two controls, you will have different values of the corresponding properties that will not be synchronized out of the box. This is why you need to select the second tab item to synchronize both properties. Moreover, you actually sync those properties on selection change.

    In order to achieve your requirement without having the need to manually update your business properties in CodeBehind on selection changed, you should expose the PanOffset and Zoom properties in your main view model. Furthermore, you need to make sure that the RadCartesianChart components are bound to the properties defined in the main view model. By doing so you will ensure that both charting components are bound to the same values of the properties and changing your business properties from either control will update the other one.

    I hope this information is helpful.

    Regards,
    Pavel R. Pavlov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top