Skip to main content

ChartElementSelectionChangedEventArgs Class

Contains data for the SelectionChanged event.

Namespace: DevExpress.WinUI.Charts

Assembly: DevExpress.WinUI.Charts.v23.2.dll

NuGet Package: DevExpress.WinUI

Declaration

public class ChartElementSelectionChangedEventArgs :
    ElementSelectionChangedEventArgs

Remarks

The chart creates an instance of the ChartElementSelectionChangedEventArgs class with the appropriate settings and passes it to the SelectionChanged event handler.

The ChartBase.SelectionChanged event occurs when a user selects or deselects series points. Use the e.Selection property to obtain selected items. The following example calculates the total area of selected countries:

private void chartOfCountriesArea_SelectionChanged(object sender, ChartElementSelectionChangedEventArgs e) {
    double totalArea = 0;
    foreach (CountryStatisticInfo point in e.Selection) {
        totalArea += point.AreaMSqrKilometers;
    }
    selectedItemsText.Text = String.Format("Total area of ​​selected countries: {0}", totalArea);
}

Use the e.ChangedElement property to get the series point whose selection state is changed. The e.IsSelected property returns this selection state. The following code calls a custom UpdateStatistics method for the last selected series point:

private void chartOfCountriesArea_SelectionChanged(object sender, ChartElementSelectionChangedEventArgs e) {
    selectedItemsText.Text = String.Format("Total area of ​​selected countries: {0}", totalArea);
    if (e.IsSelected) {
        UpdateStatistics((CountryStatisticInfo)e.ChangedElement);
    }
}

Inheritance

Object
EventArgs
ElementSelectionChangedEventArgs
ChartElementSelectionChangedEventArgs
See Also