Class SunburstSelectionChangingEventArgs
Provides data for the SelectionChanging event.
Inheritance
Namespace: Syncfusion.Maui.SunburstChart
Assembly: Syncfusion.Maui.SunburstChart.dll
Syntax
public class SunburstSelectionChangingEventArgs : EventArgs
Remarks
The SunburstSelectionChangingEventArgs class provides information about the selection change that is about to occur in the sunburst chart. This event is triggered before the selection is applied, allowing you to cancel the selection change if needed.
The event provides details about both the previously selected segment and the new segment being selected, as well as the ability to cancel the selection change.
sunburstChart.SelectionChanging += OnSelectionChanging;
private void OnSelectionChanging(object sender, SunburstSelectionChangingEventArgs args)
{
var oldSegment = args.OldSegment;
var newSegment = args.NewSegment;
// Cancel selection change, if needed.
args.Cancel = true;
}
Properties:
- OldSegmentThe segment that was previously selected before the selection change is initiated.
- NewSegmentThe segment that is about to be selected or deselected.
- CancelGets or sets a value indicating whether the selection change should be canceled.
Constructors
SunburstSelectionChangingEventArgs(SunburstSegment, SunburstSegment)
Initializes a new instance of the SunburstSelectionChangingEventArgs class.
Declaration
public SunburstSelectionChangingEventArgs(SunburstSegment oldSegment, SunburstSegment newSegment)
Parameters
Type | Name | Description |
---|---|---|
SunburstSegment | oldSegment | The previously selected segment. |
SunburstSegment | newSegment | The segment that is being selected. |
Properties
Cancel
Gets or sets a value indicating whether the selection change should be canceled.
Declaration
public bool Cancel { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
private void OnSelectionChanging(object sender, SunburstSelectionChangingEventArgs args)
{
// Cancel selection for specific categories
// Access category data through the Item property safely
string? category = "";
if (args.NewSegment?.Item is List<object?> items && items.Count >= 2)
{
category = items[0]?.ToString() ?? "";
}
if (category == "RestrictedCategory")
{
args.Cancel = true;
}
}
NewSegment
Gets the segment that is being selected.
Declaration
public SunburstSegment NewSegment { get; }
Property Value
Type | Description |
---|---|
SunburstSegment | The segment that is about to be selected. |
OldSegment
Gets the segment that was previously selected before the current selection change.
Declaration
public SunburstSegment OldSegment { get; }
Property Value
Type | Description |
---|---|
SunburstSegment | The previously selected segment, or |