SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
I have a set of ChartModifiers on my SciChartSurface, carefully configured to work together like so:
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
<s:LegendModifier x:Name="LegendModifier" />
<s:ZoomPanModifier ExecuteOn="MouseRightButton" ClipModeX="None" />
<s:RubberBandXyZoomModifier ExecuteOn="MouseLeftButton" />
<s:SeriesSelectionModifier />
<s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
<s:MouseWheelZoomModifier />
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
I also have a pair of VerticalLineAnnotations, which I create in the C#. These are used to select points on the series that has been selected with the SeriesSelectionModifier.
The problem is that after the sliders are dragged, the mouse up event causes the selected series to be unselected. How can I prevent this from happening?
It’s a bit of a hack, but I’ve got a solution that works.
I used a custom SeriesSelectionModifier that could be instructed to ignore the next mouse up:
class CustomSeriesSelectionModifier : SeriesSelectionModifier
{
public bool IgnoreNext { get; set; }
public override void OnModifierMouseUp(ModifierMouseArgs e)
{
if (IgnoreNext == false)
{
IgnoreNext = false;
base.OnModifierMouseUp(e);
}
IgnoreNext = false;
}
}
and hooked that up to the DragEnded event on the VerticalLineAnnotation:
line.DragEnded += (sender, args) =>
{
customSeriesSelectionModifier.IgnoreNext = true;
};
Of course I also had to use the custom ChartModifier in the xaml:
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
<s:LegendModifier x:Name="LegendModifier" />
<s:ZoomPanModifier ExecuteOn="MouseRightButton" ClipModeX="None" />
<s:RubberBandXyZoomModifier ExecuteOn="MouseLeftButton" />
<customChartModifiers:CustomSeriesSelectionModifier />
<s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
<s:MouseWheelZoomModifier />
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
Please login first to submit.