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

ChartView inside ItemsControl Zoom issue When using Mousewheel scroll

2 Answers 56 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Sivakumar
Top achievements
Rank 1
Sivakumar asked on 06 Jan 2016, 10:43 AM

I am using ChartView inside ItemsControl. Everything is working fine.I am facing issue when using mouse-wheel scroll for chart zoom . Issue is itemscontrol scrolling triggered instead of scroll for chart zooming even though my mouse focus on chart.

My Expected Requirement:

1.) Do Chart Zoom In/Out  When Mouse focus on chartcontrol.

2.) Do Item control scrolling when mouse focus on itemscontrol scrollbar.

  

I tried few options but those failed.Please help on this..

 

 Please see attach as well...

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Peshito
Telerik team
answered on 08 Jan 2016, 03:00 PM
Hello Sivakumar,

This behavior is caused by the fact that chart's behaviors does not handle mouse wheel events. In order to achieve your expected result please attache to charts MouseWheel event like shown below:
void chart_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            var pos = e.GetPosition(this.chart);
            ChartPanAndZoomBehavior behav = (ChartPanAndZoomBehavior)this.chart.Behaviors.FirstOrDefault(b => b is ChartPanAndZoomBehavior);
            bool isZoom = behav != null;
            if (!isZoom)
            {
                return;
            }
 
            e.Handled = true;
        }

This way when the mouse is over the chart and the wheel is being moved forward/backward, the zooming will happen. When the mouse is over the ItemsControl's scrollbar, then only the ItemsControl will scroll.

Hope it helps.

Regards,
Peshito
Telerik
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
0
Sivakumar
Top achievements
Rank 1
answered on 11 Jan 2016, 03:50 AM
Thanks for your solution.It is working now..
Tags
ChartView
Asked by
Sivakumar
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Sivakumar
Top achievements
Rank 1
Share this question
or