Hi, I have a problem with the zooming and scrolling in a simple chart application. My screen has multiple charts (line charts in this particular example), and a Scrollviewer that contains them all. The problem is that when I want to zoom in in a chart it scrolls up and when I zoom out it scrolls down in the same time. I have tried to resolve this problem by checking when the mouse is inside the chart zone and disable the scrollviewer but it didn't work because that disabled my mouse wheel for good..
This is the code I used to disable the mouse wheel for the scrollviewer and pass it to the chart control:
private
UIElement chart;
private
void
MouseLeaveChart(LineChartView lineChartView)
{
// this is triggered when the mouse leaves the chart area
chart =
null
;
}
private
void
MouseEnterChart(RadCartesianChart radCartesianChart)
{
// this is triggered when the mouse enters the chart area
chart = radCartesianChart;
}
private
void
ScrollViewer_OnPreviewMouseWheel(
object
sender, MouseWheelEventArgs e)
{
if
(chart !=
null
)
{
e.Handled =
true
;
var e2 =
new
MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
e2.RoutedEvent = UIElement.MouseWheelEvent;
chart.RaiseEvent(e2);
}
}
Any kind of help is highly appreciated, thank you in advance!