Radcartesianchart Synchronize vertical axis scroll

1 Answer 108 Views
ChartView
Junwan
Top achievements
Rank 1
Junwan asked on 15 Jul 2021, 02:04 AM

Hello.

 

I read this article.

https://www.telerik.com/forums/radcartesianchart-synchronize-scrolling

 

If I set to XAML, It's works.

But, I want to know how to set code behind Binding property. (Because, chart is making dynamic numbers)

I try to like below. But It doesn't work. 

Please check and help me.

 

RadCartesianChart chart = new RadCartesianChart();

RadCartesianChart chart1 = new RadCartesianChart();

chart.Name = "chart";

Binding bds = new Binding();
bds.ElementName = "chart";
bds.Mode = BindingMode.TwoWay;
bds.Path = new PropertyPath("VerticalZoomRangeStart");

Binding bde = new Binding();
bde.ElementName = "chart";
bde.Mode = BindingMode.TwoWay;
bde.Path = new PropertyPath("VerticalZoomRangeEnd");

BindingOperations.SetBinding(chart1, RadCartesianChart.VerticalZoomRangeStartProperty, bds);
BindingOperations.SetBinding(chart1, RadCartesianChart.VerticalZoomRangeEndProperty, bde);

 

Thanks.

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 15 Jul 2021, 01:01 PM

Hello Junwan,

To fix this you can replace the ElementName setting of the Binding objects with the Source property and set the wanted data context. In your case it will be the chart class instance:

bds.Source = chart;
bde.Source = chart;

I am attaching a sample project for you to test.

Regards, Stenly Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
ChartView
Asked by
Junwan
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or