How to modify Binding Source as chip cleared with close button

Hello,
I'm creating a SfChipGroup as in your Getting Started example . I would like to have a dynamic group of SfChips having the close button and a Command binded to each, I am having a checkbox list and once the user selects a check box item this needs to be added as a chip item. And once close button is clicked the the chip needs to be cleared. I have achieved the first part, Populating the selected chip. I have added close button, It is getting cleared 

- how I get the the itemsource to be updated once the user deletes a chip by close button,
I am following view model pattern


                       
        ItemsSource="{Binding SelectedSpecialityDiseaseModels}" 
        ChipPadding="8,8,0,0" 
        DisplayMemberPath="DisplayName">
                           
                               
        HorizontalOptions="Start" 
        VerticalOptions="Center" 
        Direction="Row" 
        Wrap="Wrap"
        JustifyContent="Start"
        AlignContent="Start" 
        AlignItems="Start"/>
                           
                           
                               
                                    EventName="SelectionChanged"
                                    Command="{Binding SelectionChangedCommand}" />
                           
                       

Thanks in advance
Ajit

5 Replies

HM Hemalatha Marikumar Syncfusion Team May 1, 2020 03:36 PM UTC

Hi Ajith Gopalakrishnan, 
 
Greetings from Syncfusion. 
 
Query: Is there a way to get binding of which the value as been cleared? 
 
We would like to let you know that you get the cleared chip /model value from its CollectionChanged event of populated collection of SfChipGroup (if you are loaded as ObservableCollection) or else directly get from ChildRemoved event of FlexLayout as per in below screenshots 
 
ChildRemoved event in FlexLayout: 
 


 
CollectionChanged event with Remove action:

 
public ViewModel() 
        { 
            employees = new ObservableCollection<Person>(); 
            employees.CollectionChanged += Employees_CollectionChanged; 
            employees.Add(new Person() { Name = "John" }); 
            employees.Add(new Person() { Name = "James" }); 
            employees.Add(new Person() { Name = "Linda" }); 
            employees.Add(new Person() { Name = "Rose" }); 
            employees.Add(new Person() { Name = "Mark" }); 
        } 
 
        private void Employees_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) 
        { 
            if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove) 
            { 
                Person person = (e.OldItems)?[0] as Person; 
                DeletedChip = person; 
            } 
            if(e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) 
            { 
 
            } 
        } 


Below demo sample to display the deleted chip’s text by keeping DeletedChip property in ViewModel
 
 
Sample Link: 
 
https://www.syncfusion.com/downloads/support/forum/153818/ze/GettingStarted428409187


On the provided code snippet, you have used SelectionChanged event. For your information, SelectionChanged event triggered only for Choice/Filter typed chip group. For Input type, it won’t triggered. To get your requirement, better to use ChipClicked event. 
 
To know more about this, please refer the below link 
 
 
 
Regards,
Hemalatha M.
 
 
 
 
 
 
 
  



AG Ajith Gopalakrishnan May 1, 2020 06:26 PM UTC

Hi Hemalatha

Thanks for the prompt Reply. I have addressed the issue with the sample you have Provided 

Ajit


DD Devakumar Dhanapoosanam Syncfusion Team May 4, 2020 06:38 AM UTC

Hi Ajith Gopalakrishnan, 
 
Sorry for the inconvenience caused. 
 
The reported issue “while tapping the close button in ChipGroup, doesn’t remove it from the layout in UWP” is already in validation and our development team are validating the root cause of this. Hence, we will update the complete validated state and its fix details on May 6,2020. 
 
We really appreciate your patience until then. 
 
Regards, 
Devakumar D 



DD Devakumar Dhanapoosanam Syncfusion Team May 6, 2020 09:41 AM UTC

Hi Ajith Gopalakrishnan, 
 
Thanks for your patience. 
 
We would like to let you know that we have already pointing out this bug in UWP and we are currently working this with high priority. We will fix and ensure that with all possible cases and include this fix in our upcoming Volume 1 SP1 2020 release which is expected to be rolled out by mid of May 2020. 
 
Regards, 
Devakumar D 



SJ Suyamburaja Jayakumar Syncfusion Team May 25, 2020 12:06 PM UTC

Hi Ajith Gopalakrishnan,  
  
Thanks for your patience.  
   
We are glad to announce that our Essential Studio 2020 Volume 1 SP release v18.1.0.52 is rolled out and is available for download under the following link.  
   
   
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.  
  
Regards,  
Suyamburaja J. 


Loader.
Up arrow icon