<SyncfusionButton:SfChipGroup SelectionChanged="SfChipGroup_SelectionChanged"
SelectedChipTextColor="#FF202020"
SelectedItems="{Binding SelectedItems,Mode=TwoWay}"
SelectedChipBackgroundColor="#FFB6B6B6"
SelectionIndicatorColor="#FF353535"
ChipPadding="2,0,0,0"
ItemsSource="{Binding FilterItems,Mode=TwoWay}"
Type="Filter"> |
private void SfChipGroup_SelectionChanged(object sender, Syncfusion.Buttons.XForms.SfChip.SelectionChangedEventArgs e)
{
//To get the recently selected and unselected chip
} |
public class ChipViewModel : INotifyPropertyChanged
{
#region properties
……
private ObservableCollection<string> selectedItems = new ObservableCollection<string>();
……
public ObservableCollection<string> SelectedItems
{
get
{
return selectedItems;
}
set
{
selectedItems = value;
OnPropertyChanged("SelectedItems");
}
}
……
public ChipViewModel()
{
ActionCommand = new Command(HandleAction);
SelectedItems.CollectionChanged += SelectedItems_CollectionChanged;
}
private void SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if(e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
//get added chip - e.NewItems[e.NewStartingIndex]
}
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
{
//get removed chip - e.OldItems[e.OldStartingIndex]
}
}
……
} |