To reproduce:
- Subscribe to the SelectedPointChanged event and show a dialog in it.
- Start the chart and zoom in. Select a point, close the dialog and select a point again.
Workaround:
class MyChartSelectionController : ChartSelectionController
{
protected override ActionResult OnMouseDown(MouseEventArgs e)
{
//return base.OnMouseDown(e);
return Controller.Empty;
}
protected override ActionResult OnMouseUp(MouseEventArgs e)
{
if (!this.AllowSelect || this.SelectionMode == ChartSelectionMode.None)
{
return base.OnMouseUp(e);
}
DataPoint oldDataPoint = SelectedPoint;
DataPoint newDataPoint = null;
ChartSeries oldSeries = SelectedSeries;
ChartSeries newSeries = null;
DataPoint point = null;
foreach (ChartSeries series in this.Area.Series)
{
point = series.HitTest(e.X, e.Y);
if (point != null)
{
newDataPoint = point;
newSeries = series;
break;
}
}
if (point == null)
{
return base.OnMouseUp(e);
}
ChartViewSelectedPointChangingEventArgs cancelArgs = new ChartViewSelectedPointChangingEventArgs(oldDataPoint, newDataPoint, oldSeries, newSeries, this.SelectionMode);
OnSelectedPointChanging(cancelArgs);
if (cancelArgs.Cancel == true)
{
return base.OnMouseUp(e);
}
if (oldDataPoint == newDataPoint)
{
oldDataPoint.IsSelected = !oldDataPoint.IsSelected;
newDataPoint = null;
SelectedPoint = null;
}
else
{
if (this.SelectionMode == ChartSelectionMode.SingleDataPoint && oldDataPoint != null)
{
oldDataPoint.IsSelected = false;
}
this.SelectedPoint = newDataPoint;
this.SelectedPoint.IsSelected = !SelectedPoint.IsSelected;
}
ChartViewSelectedPointChangedEventArgs changedArgs = new ChartViewSelectedPointChangedEventArgs(oldDataPoint, newDataPoint, oldSeries, newSeries, this.SelectionMode);
OnSelectedPointChanged(changedArgs);
return base.OnMouseUp(e);
}
}