SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
Hi All,
I’ve read the following forum entry on using a context menu with and ALT-Right click to get around problems with event interference:
I have the same problem with zoom and implemented the solution mentioned above. Then I noticed on one of my test apps that the two would live side by side quite nicely without doing anything BUT it made selecting a scatter series trickier. i found that using ReceiveHandledEvents had an effect on the behaviour in that while this was false zoom and context were fine but selecting a series was a bit hit and miss, but while it was true the behaviour in the link was displayed i.e. context menu appearing after zoom operation.
Here’s the XAML;
<s:SciChartSurface x:Name="ChartSurface" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" s:ThemeManager.Theme="Chrome">
<s:SciChartSurface.ContextMenu>
<ContextMenu>
<MenuItem Header="Item1" />
<MenuItem Header="Item2" />
<MenuItem Header="Item3" />
<MenuItem Header="Etc.." />
</ContextMenu>
</s:SciChartSurface.ContextMenu>
<s:SciChartSurface.XAxis>
<s:DateTimeAxis AutoRange="Once"/>
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxes>
<s:NumericAxis x:Name="LinearAxis" Id="LinearAxis" AutoRange="Always" AxisAlignment="Left" AxisTitle="Linear" Style="{StaticResource LinearScaleStyle}"/>
</s:SciChartSurface.YAxes>
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
<s:RubberBandXyZoomModifier x:Name="rubberBandZoomModifier" IsEnabled="True" IsXAxisOnly="False" IsAnimated="True" ExecuteOn="MouseRightButton" ZoomExtentsY="False" ReceiveHandledEvents="True"/>
<s:ZoomPanModifier x:Name="zoomPanModifier" ExecuteOn="MouseLeftButton" ZoomExtentsY="False" ReceiveHandledEvents="True" IsEnabled="True" XyDirection="XDirection"/>
<!--
ReceiveHandledEvents * True = context menu appears on completion of a right mouse button zoom operation
ReceiveHandledEvents * False = Zoom and Context menu are fine but selecting a series needs a slow double click type thing
-->
<s:SeriesSelectionModifier ReceiveHandledEvents="True">
</s:SeriesSelectionModifier>
<s:LegendModifier x:Name="SelectedSeriesLegend" ShowLegend="True" GetLegendDataFor="SelectedSeries" Margin="5" SourceMode="AllVisibleSeries" />
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
</s:SciChartSurface>
Can anyone explain this? Is there an accepted workaround? are there any other easy methods of selecting a series that don’t involve clicking on it (e.g. select from legend)?
Thanks in advance
/Stu
Hi Stuart, if you point WPF Snoop at your application, and navigate to the Events tab, can you see what element is handling your event?
Please login first to submit.