# Selection

## Content



Selection in charts helps the end-user to select the required data point or the whole series at run-time during analysis, etc.

In FlexChart, selection is disabled by default. However, you can enable the selection by setting the [SelectionMode](/componentone/api/winui/online-winui/dotnet-api/C1.WinUI.Chart/C1.WinUI.Chart.FlexChartBase.SelectionMode.html) property. This property allows you to set the selection mode to either Series or Point using the [ChartSelectionMode](/componentone/docs/winui/online-winui/) enumeration. FlexChart also lets you get or set the index of the selected item using the [SelectedIndex](/componentone/api/winui/online-winui/dotnet-api/C1.WinUI.Chart/C1.WinUI.Chart.FlexChartBase.SelectedIndex.html) property. Moreover, it provides a SelectionChanged event which notifies when the selected point or series is changed so that you can customize the selection process according to the requirements. You can also customize how a selected item should appear by using the [SelectionStyle](/componentone/api/winui/online-winui/dotnet-api/C1.WinUI.Chart/C1.WinUI.Chart.FlexChartBase.SelectionStyle.html) property. The property is of ChartStyle type and lets you change the fill, fill color, stroke, stroke color, line pattern etc.

| ![WinUI FlexChart Selection](https://cdn.mescius.io/document-site-files/images/2d49eac2-0942-4770-99ef-52b14e6815bd/images/flexchart-selection.gif) |
| --- |

Following C# code is required to show the selection in charts at runtime. This sample uses the same datasource as used in [Quick Start](/componentone/docs/winui/online-winui/winui-controls/flexchart-overview/flexchart-quickstart).

```xml
flexChart.SelectionMode = ChartSelectionMode.Point;
flexChart.SelectedIndex = 2;
flexChart.SelectionStyle = new C1.WinUI.Chart.ChartStyle()
{
    Stroke = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 0, 255)),
    StrokeThickness = 2
};
```