Class ChartSelectionBehavior
Inheritance
Inherited Members
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.Chart.WinUI.dll
Syntax
public abstract class ChartSelectionBehavior : ChartBehavior
Constructors
ChartSelectionBehavior()
Initializes a new instance of the ChartSelectionBehavior class.
Declaration
public ChartSelectionBehavior()
Fields
SelectedIndexesProperty
The DependencyProperty for SelectedIndexes property.
Declaration
public static readonly DependencyProperty SelectedIndexesProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
SelectedIndexProperty
The DependencyProperty for SelectedIndex property.
Declaration
public static readonly DependencyProperty SelectedIndexProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
SelectionBrushProperty
The DependencyProperty for SelectionBrush property.
Declaration
public static readonly DependencyProperty SelectionBrushProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
TypeProperty
The DependencyProperty for Type property.
Declaration
public static readonly DependencyProperty TypeProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Properties
SelectedIndex
Gets or sets the index of segment or series to be selected in selection behavior.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | This property takes System.Int32 value and its default value is -1. |
Remarks
This property value is used only when Type is set to Single or SingleDeselect.
Examples
<chart:SfCircularChart>
<chart:PieSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
<chart:PieSeries.SelectionBehavior>
<chart:DataPointSelectionBehavior SelectedIndex="3" SelectionBrush = "Red" />
</chart:PieSeries.SelectionBehavior>
</chart:PieSeries>
</chart:SfCircularChart>
SelectedIndexes
Gets or sets the list of segments or series to be selected in selection behavior.
Declaration
public List<int> SelectedIndexes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Int32> | This property takes the list of System.Int32 values and its default value is null. |
Remarks
Examples
<chart:SfCircularChart>
<chart:PieSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
<chart:PieSeries.SelectionBehavior>
<chart:DataPointSelectionBehavior SelectedIndexes="{Binding indexes}" SelectionBrush = "Red" />
</chart:PieSeries.SelectionBehavior>
</chart:PieSeries>
</chart:SfCircularChart>
SelectionBrush
Gets or sets the selection brush color for selection behavior.
Declaration
public Brush SelectionBrush { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Media.Brush | This property takes Microsoft.UI.Xaml.Media.Brush value and its default value is null. |
Examples
<chart:SfCircularChart>
<chart:PieSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
<chart:PieSeries.SelectionBehavior>
<chart:DataPointSelectionBehavior SelectionBrush = "Red" />
</chart:PieSeries.SelectionBehavior>
</chart:PieSeries>
</chart:SfCircularChart>
Type
Gets or sets the selection mode for selection behavior.
Declaration
public ChartSelectionType Type { get; set; }
Property Value
Type | Description |
---|---|
ChartSelectionType | One of the ChartSelectionType. The default is Single selection. |
Remarks
It's used to select single or multiple segments or series.
Examples
<chart:SfCircularChart>
<chart:PieSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
<chart:PieSeries.SelectionBehavior>
<chart:DataPointSelectionBehavior Type="Multiple" SelectionBrush = "Red" />
</chart:PieSeries.SelectionBehavior>
</chart:PieSeries>
</chart:SfCircularChart>
Methods
OnPointerPressed(PointerRoutedEventArgs)
Declaration
protected override void OnPointerPressed(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | e |
Overrides
OnPointerReleased(PointerRoutedEventArgs)
Declaration
protected override void OnPointerReleased(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | e |
Overrides
Events
SelectionChanged
Occurs when the user clicks on series segment or sets the value for the SelectedIndex property. Here you can get the corresponding series, current selected index, and previous selected index.
Declaration
public event EventHandler<ChartSelectionChangedEventArgs> SelectionChanged
Event Type
Type |
---|
System.EventHandler<ChartSelectionChangedEventArgs> |
SelectionChanging
Occurs when the user clicks on the series segment or sets the value for SelectedIndex property. This event is triggered before a segment or series is selected.
Declaration
public event EventHandler<ChartSelectionChangingEventArgs> SelectionChanging
Event Type
Type |
---|
System.EventHandler<ChartSelectionChangingEventArgs> |
Remarks
Restrict a data point from being selected, by canceling this event, by setting cancel property to true in the event argument.