Class DataPointSelectionBehavior

    Show / Hide Table of Contents

    Class DataPointSelectionBehavior

    Enables the selection of individual or multiple data points in a series.

    Inheritance
    System.Object
    ChartBehavior
    ChartSelectionBehavior
    DataPointSelectionBehavior
    Inherited Members
    ChartSelectionBehavior.TypeProperty
    ChartSelectionBehavior.SelectionBrushProperty
    ChartSelectionBehavior.SelectedIndexProperty
    ChartSelectionBehavior.SelectedIndexesProperty
    ChartSelectionBehavior.OnPointerReleased(PointerRoutedEventArgs)
    ChartSelectionBehavior.OnPointerPressed(PointerRoutedEventArgs)
    ChartSelectionBehavior.Type
    ChartSelectionBehavior.SelectionBrush
    ChartSelectionBehavior.SelectedIndex
    ChartSelectionBehavior.SelectedIndexes
    ChartSelectionBehavior.SelectionChanged
    ChartSelectionBehavior.SelectionChanging
    ChartBehavior.OnDoubleTapped(DoubleTappedRoutedEventArgs)
    ChartBehavior.OnHolding(HoldingRoutedEventArgs)
    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)
    Namespace: Syncfusion.UI.Xaml.Charts
    Assembly: Syncfusion.Chart.WinUI.dll
    Syntax
    public class DataPointSelectionBehavior : ChartSelectionBehavior
    Remarks

    To enable the data point selection in the chart, create an instance of DataPointSelectionBehavior and set it to the SelectionBehavior property of the chart or series. To highlight the selected segment data label, set the value for SelectionBrush property in DataPointSelectionBehavior.

    It provides the following options to customize the appearance of selected data point:

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

    SelectionBrush - To highlight the selected data point, refer to the SelectionBrush property.

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

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

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

    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCircularChart>
    
            <chart:SfCircularChart.DataContext>
                <local:ViewModel/>
            </chart:SfCircularChart.DataContext>
    
            <chart:PieSeries ItemsSource="{Binding Data}"
                             XBindingPath="XValue"
                             YBindingPath="YValue">
                <chart:PieSeries.SelectionBehavior>
                    <chart:DataPointSelectionBehavior SelectionBrush = "Red" />
            </chart:PieSeries.SelectionBehavior>
            </chart:PieSeries>
    
    </chart:SfCircularChart>
     SfCircularChart chart = new SfCircularChart();
     ViewModel viewModel = new ViewModel();
    
     PieSeries series = new PieSeries()
     {
        ItemsSource = viewModel.Data,
        XBindingPath = "XValue",
        YBindingPath = "YValue",
     };
    
     series.SelectionBehavior = new DataPointSelectionBehavior()
     {
         SelectionBrush = new SolidColorBrush(Colors.Red),
     };
    
     chart.Series.Add(series);

    Constructors

    DataPointSelectionBehavior()

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