SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
I’m playing with the DatPointSelectionModifier which seems mostly what i need but I have two problems as follows:
1/ I have started a selection operation by dragging over an area containing some points and I decide that I don’t want that area after all and want to cancel the operation (much like file explorer file dragging – hitting escape cancels the operation) – How do I do that?
2/ I have a set of selected points and drag to select another set which overlaps the first set. I would like the any points in the overlap to invert from selected to unselected and vice versa. How would I know which points are encompassed by the drag operation so i can work out the overlap?
Thanks for any suggestions
/Stuart
Hi Stuart,
As per a customer feature request, we made it easier to override the DataPointSelectionModifier SelectionMode.
See this snippet of code.
/// <summary>
/// When overriden in derived classes, is used to override the default selection behavior.
/// </summary>
/// <param name="modifierKey">The modifier key which has been pressed.</param>
/// <param name="isAreaSelection"><value>True</value> when selection was performed by dragging a reticule, othetwise <value>False</value>.</param>
/// <returns></returns>
protected virtual SelectionMode GetSelectionMode(MouseModifier modifierKey, bool isAreaSelection)
{
var selectionMode = SelectionMode.Replace;
if (!AllowsMultiSelection)
{
return selectionMode;
}
switch (modifierKey)
{
case MouseModifier.Ctrl:
selectionMode = isAreaSelection ? SelectionMode.Union : SelectionMode.Inverse;
break;
case MouseModifier.Shift:
selectionMode = SelectionMode.Inverse;
break;
}
return selectionMode;
}
This is taken from DataPointSelectionModifier.cs. As you can see SelectionMode depends on the key currently pressed (CTRL or SHIFT).
If you derive a class from DataPointSelectionModifier and override this method you should be able to implement the desired behaviour.
Best regards,
Andrew
Please login first to submit.