This is a migrated thread and some comments may be shown as answers.

ChartView: Zoom And PanOffset Binding

1 Answer 184 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Lenka
Top achievements
Rank 1
Lenka asked on 27 May 2014, 10:49 PM
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

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 30 May 2014, 12:52 PM
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.
 
Tags
ChartView
Asked by
Lenka
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or