Events in .NET MAUI Chips

SelectionChanging Event

The SelectionChanging event is triggered before the Chip is selected. You can restrict a chip from being selected, by canceling this event, by setting Cancel property in the event argument to true. The argument contains the following information,

  • [AddedItem] - Used to get the selected chip from SfChipGroup.
  • [RemovedItem] - Used to get the previous selected or deselected chip from SfChipGroup.
  • [Cancel] - Used to set the value indicating whether the selection should be canceled.

SelectionChanged Event

The SelectionChanged event triggered after a chip is selected. The argument contains the following information,

  • [AddedItem] - Get the selected chip from SfChipGroup.
  • [RemovedItem] - Get the previous selected or deselected chip from SfChipGroup.

NOTE

Currently, Choice and Filter types are only supported for SelectionChanging and SelectionChanged events.

ChipClicked

The ChipClicked event is triggered when a chip clicked in the [SfChipGroup]. The event argument is type of EventArgs.

ItemRemoved Event

The ItemRemoved event is triggered after the chip is removed from SfChipGroup. The argument contains the following information,

  • [RemovedItem] - Get the removed chip item from the SfChipGroup.

NOTE

The [ItemRemoved] event is supported only in the Input type.

CloseButtonClicked

The CloseButtonClicked event is triggered when the closed button is clicked. The event argument is type of EventArgs.

<chip:SfChip WidthRequest="100"
                x:Name="chip"
                CloseButtonClicked="SfChip_CloseButtonClicked"/>
SfChip chip = new SfChip();
   chip.CloseButtonClicked+=chip_CloseButtonClicked;
private async void SfChip_CloseButtonClicked(object sender, EventArgs e)
        {
            await DisplayAlert("Message", "Chip CloseButton Clicked", "close");
        }