We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Using Filter type and need to set some chips to be checked programatically

I am using SfChipGroup in order to create a filter in our app. In our app, the user will tap the ones they want and then save. We are grabbing all of the selected chips from SelectedItems and then storing that for future use. That would fine.

What we are not able to do is when the user goes back to the group we want to check the chips that they had selected before. Setting SfChipGroup.Items[x].IsChecked does not seem to do anything.

How can we make this work?


3 Replies

LA Lavanya Anaimuthu Syncfusion Team June 15, 2019 10:42 AM

Hi Carl, 
Thanks for contacting Syncfusion Support. 
We glad to achieve your requirement " holding selected items using SelectedItems property". 
Query: We want to check the chips they has selected before. 
SelectedItems is just to hold only the selected items property. If those selected items are removed from its selection, it also removed from SelectedItems property also. 
We understood that you need a collection to holds only the previously selected chips. If that means we can get that from SelectionChanged event like in below 
[XAML] MainPage.xaml 
                ItemsSource="{Binding ChipItems}"
                SelectedItems="{Binding SelectedItems}"
            <Label Text="Already selected Chips" Margin="0,10,0,0"/>
            <ListView ItemsSource="{Binding PreviouslySelectedItems}">
                            <Label Text="{Binding Product}" />
[C#] MainPage.xaml.cs 
  private void SfChipGroup_SelectionChanged(object sender, Syncfusion.Buttons.XForms.SfChip.SelectionChangedEventArgs e)
            if (!viewModel.PreviouslySelectedItems.Contains(e.AddedItem) && e.AddedItem != null)
                viewModel.PreviouslySelectedItems.Add(e.AddedItem as Model);
PreviouslySelectedItems holds only the selected chips from ChipGroup.  We have prepared a simple sample to achieve your requirement. 
If we misunderstood query, please update us with more details to check further and provide a better solution. 
Lavanya A. 

BC Blaise Coco June 15, 2019 11:56 AM

Thanks. That will work fine for me. 

MK Muneesh Kumar G Syncfusion Team June 17, 2019 12:52 AM

Hi Carl,  
Thanks for the update. 
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
Muneesh Kumar G. 

Live Chat Icon For mobile
Up arrow icon