Hi,
I’m using SciChartGroup with SciChartSurface, each surface contains a set of modifiers, but when I add both CursorModifier and ZoomPanModifier at the same time, the ZoomPanModifier stops working.
<s:SciChartGroup ItemsSource="{Binding ChartPaneViewModels}"> <s:SciChartGroup.ItemTemplate> <DataTemplate> <s:SciChartSurface SeriesSource="{Binding ChildPane.SeriesViewModels}"> <s:SciChartSurface.ChartModifier> <s:ModifierGroup> <s:CursorModifier /> <!--<s:XAxisDragModifier/> <s:MouseWheelZoomModifier/> <s:RubberBandXyZoomModifier ExecuteOn="MouseRightButton" IsXAxisOnly="True"/>--> <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/> <s:ZoomPanModifier ExecuteOn="MouseLeftButton" ClipModeX="None"/> </s:ModifierGroup> </s:SciChartSurface.ChartModifier> <s:SciChartSurface.XAxis> <s:CategoryDateTimeAxis AxisAlignment="Bottom" VisibleRange="{Binding ChildPane.Range, Mode=TwoWay}"/> </s:SciChartSurface.XAxis> <s:SciChartSurface.YAxis> <s:NumericAxis AutoRange="Always" AxisAlignment="Right"> <s:NumericAxis.GrowBy> <s:DoubleRange Max="0.1" Min="0.1"/> </s:NumericAxis.GrowBy> </s:NumericAxis> </s:SciChartSurface.YAxis> </s:SciChartSurface> </DataTemplate> </s:SciChartGroup.ItemTemplate> </s:SciChartGroup>
Error reproduced on SciChart version 2.2 and 2.3, on version 1.x it worked fine.
- esper asked 11 years ago
- You must login to post comments
Hi there,
Please see our KB article on How to Add Mouse Interaction to SciChart, the section on ChartModifier Precedence and Handled mouse events.
ChartModifier Precedence (Handled Events)
ChartModifiers obey a precedence, rather like WPF RoutedEvents. If you have a number of modifiers in a SciChartSurface, then the first modifier that handles an event marks it as e.Handled. Subsequent modifiers will not receive the event.
For instance, consider the following code:
If you drag the chart, then the series will not be selected too, because the RubberBandXyZoomModiifer marks MouseUp as Handled. The SeriesSelectionModifier relies on MouseUp to select. If the event is handled then it will not select.
So far this is all intuitive and good. But what about this case?
Working around event handling with ReceiveHandledEvents
The solution to the above problem is to set ReceiveHandledEvents=True on a modifier. This way the modifier will receive all events, even those marked as handled. Try the following code for instance:
Be careful with this flag though as it could enable event handling where it should not occur.
- Andrew Burnett-Thompson answered 11 years ago
-
Yes, it helped. Thanks.
- You must login to post comments
Please login first to submit.