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?
- Robert Evans asked 9 years ago
- last edited 9 years ago
- You must login to post comments
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>
- Robert Evans answered 9 years ago
-
I'm guessing this has something to do with the events used and ensuring the event is marked as e.Handled. Another thing you could do is handle VerticalLineAnnotation.MouseUp and ensure e.Handled is set to true. I'll mention this to the team and see if there is anything else we can do.
-
Thanks Andrew. I tried handling VerticalLineAnnotation.MouseUp and ensuring e.Handled is set to true, but doing that prevented the drag from completing properly.
- You must login to post comments
Please login first to submit.