menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SeriesSelectionBehavior - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SeriesSelectionBehavior

    Enables the selection of individual or multiple series in a SfCartesianChart.

    Inheritance
    System.Object
    ChartBehavior
    ChartSelectionBehavior
    SeriesSelectionBehavior
    Inherited Members
    ChartBehavior.OnDoubleTapped(DoubleTappedRoutedEventArgs)
    ChartBehavior.OnHolding(HoldingRoutedEventArgs)
    ChartBehavior.OnLayoutUpdated()
    ChartBehavior.OnManipulationCompleted(ManipulationCompletedRoutedEventArgs)
    ChartBehavior.OnManipulationDelta(ManipulationDeltaRoutedEventArgs)
    ChartBehavior.OnManipulationStarted(ManipulationStartedRoutedEventArgs)
    ChartBehavior.OnPointerEntered(PointerRoutedEventArgs)
    ChartBehavior.OnPointerExited(PointerRoutedEventArgs)
    ChartBehavior.OnPointerMoved(PointerRoutedEventArgs)
    ChartBehavior.OnPointerWheelChanged(PointerRoutedEventArgs)
    ChartBehavior.OnRightTapped(RightTappedRoutedEventArgs)
    ChartBehavior.OnTapped(TappedRoutedEventArgs)
    ChartSelectionBehavior.OnPointerPressed(PointerRoutedEventArgs)
    ChartSelectionBehavior.OnPointerReleased(PointerRoutedEventArgs)
    ChartSelectionBehavior.SelectedIndex
    ChartSelectionBehavior.SelectedIndexes
    ChartSelectionBehavior.SelectedIndexesProperty
    ChartSelectionBehavior.SelectedIndexProperty
    ChartSelectionBehavior.SelectionBrush
    ChartSelectionBehavior.SelectionBrushProperty
    ChartSelectionBehavior.SelectionChanged
    ChartSelectionBehavior.SelectionChanging
    ChartSelectionBehavior.Type
    ChartSelectionBehavior.TypeProperty
    Namespace: Syncfusion.UI.Xaml.Charts
    Assembly: Syncfusion.Chart.WinUI.dll
    Syntax
    public class SeriesSelectionBehavior : ChartSelectionBehavior
    Remarks

    To enable the series selection in the chart, create an instance of SeriesSelectionBehavior and set it to the SelectionBehavior property of chart. To highlight the selected series, set the value for SelectionBrush property in SeriesSelectionBehavior.

    It is applicable only for SfCartesianChart.

    It provides the following options to customize the appearance of selected series:

    Type - To select single or multiple series in a chart, refer to the Type property.

    SelectionBrush - To highlight the selected series, refer to the SelectionBrush property.

    SelectedIndex - To select a series programmatically, refer to the SelectedIndex property.

    SelectedIndexes - To select multiple series programmatically, refer to the SelectedIndexes property.

    Events - The SelectionChanging event occurs before the series is selected. The SelectionChanged event occurs after a series has been selected.

    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
        <chart:SfCartesianChart>
    
           <chart:SfCartesianChart.SelectionBehavior>
              <chart:SeriesSelectionBehavior SelectionBrush ="Red" />
            </chart:SfCartesianChart.SelectionBehavior>
    
           <chart:LineSeries ItemsSource ="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue1" />
           <chart:LineSeries ItemsSource ="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue2" />
    
       </chart:SfCartesianChart>
     SfCartesianChart chart = new SfCartesianChart();
     ViewModel viewModel = new ViewModel();
    
     chart.SelectionBehavior = new SeriesSelectionBehavior()
     {
         SelectionBrush = new SolidColorBrush(Colors.Red),
     };
    
     LineSeries series = new LineSeries()
     {
        ItemsSource = viewModel.Data,
        XBindingPath = "XValue",
        YBindingPath = "YValue1",
     };
    
     LineSeries series = new LineSeries()
     {
        ItemsSource = viewModel.Data,
        XBindingPath = "XValue",
        YBindingPath = "YValue2",
     };
    
     chart.Series.Add(series);

    Constructors

    SeriesSelectionBehavior()

    Declaration
    public SeriesSelectionBehavior()
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved