Class SfChip
Represents a Chip control which can be added in a layout and grouped using SfChipGroup. Represents the SfChip class.
Implements
Inherited Members
Namespace: Syncfusion.Maui.Toolkit.Chips
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public class SfChip : ButtonBase, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITouchListener, ITextElement, ITapGestureListener, IGestureListener, IParentThemeElement, IThemeElement
Constructors
SfChip()
Initializes a new instance of the SfChip class.
Declaration
public SfChip()
Fields
CloseButtonColorProperty
Identifies the CloseButtonColor bindable property.
Declaration
public static readonly BindableProperty CloseButtonColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The CloseButtonColor property determines the color of the close button.
CloseButtonPathProperty
Identifies the CloseButtonPath bindable property.
Declaration
public static readonly BindableProperty CloseButtonPathProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The CloseButtonPath property determines the path of the close button.
SelectionIndicatorColorProperty
Identifies the SelectionIndicatorColor bindable property.
Declaration
public static readonly BindableProperty SelectionIndicatorColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The SelectionIndicatorColor property determines the color of the selection indicator.
ShowCloseButtonProperty
Identifies the ShowCloseButton bindable property.
Declaration
public static readonly BindableProperty ShowCloseButtonProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The ShowCloseButton property determines whether the close button is visible or not.
ShowSelectionIndicatorProperty
Identifies the ShowSelectionIndicator bindable property.
Declaration
public static readonly BindableProperty ShowSelectionIndicatorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The ShowSelectionIndicator property determines whether the selection indicator is visible or not.
Properties
CloseButtonColor
Gets or sets the value that can be used to change the color of the close button.
Declaration
public Color CloseButtonColor { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Color | It accepts Microsoft.Maui.Graphics.Color values and the default value is Color.FromArgb("#1C1B1F"). |
Remarks
This property allows you to customize the appearance of the close button by setting its color.
Examples
Here is an example of how to set the CloseButtonColor property
CloseButtonPath
Gets or sets the value of CloseButtonPath. This property can be used to customize the close button.
Declaration
public string CloseButtonPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | Specifies the close button path. The default value is System.String.Empty. |
Remarks
This property allows you to set a custom path for the close button icon, enabling you to use a custom SVG or other path data.
Examples
Here is an example of how to set the CloseButtonPath property
IsSelected
Gets a value indicating whether the SfChip is selected.
Declaration
public bool IsSelected { get; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value indicating the selection state of the chip. The default value is false. |
Remarks
This property allows you to determine if the chip is currently selected. It is internally set and cannot be modified directly.
SelectionIndicatorColor
Gets or sets the value of SelectionIndicatorColor. This property can be used to change the color of the selection indicator.
Declaration
public Color SelectionIndicatorColor { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Color | Specifies the selection indicator color. The default value is Color.FromArgb("#49454F"). |
Remarks
This property allows you to customize the color of the selection indicator.
Examples
Here is an example of how to set the SelectionIndicatorColor property
ShowCloseButton
Gets or sets a value indicating whether the close button is visible or not. The close button is in a visible state when this property is set to true.
Declaration
public bool ShowCloseButton { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Specifies the show close button property. The default value is false. |
Remarks
This property allows you to control the visibility of the close button on the chip.
Examples
Here is an example of how to set the ShowCloseButton property
ShowSelectionIndicator
Gets or sets a value indicating whether the selection indicator is visible or not. The selection indicator is in a visible state when this property is set to true.
Declaration
public bool ShowSelectionIndicator { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Specifies the show selection indicator property. The default value is false. |
Remarks
This property allows you to control the visibility of the selection indicator on the chip.
Examples
Here is an example of how to set the ShowSelectionIndicator property
Events
CloseButtonClicked
Occurs when the close button is clicked/tapped.
Declaration
public event EventHandler<EventArgs> CloseButtonClicked
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
Examples
Here is an example of how to register the CloseButtonClicked event.
SfChip chip = new SfChip();
chip.CloseButtonClicked += chip_CloseButtonClicked;
private async void chip_CloseButtonClicked(object sender, EventArgs e)
{
await DisplayAlert("Message", "Chip CloseButton Clicked", "close");
}