<FlexLayout.Behaviors> <local:EventToCommandBehavior EventName="ChildRemoved" Command="{Binding ClickCommand}" /> </FlexLayout.Behaviors> |
<buttons:SfChipGroup ItemHeight="60" /> |
Hi Matteo,
Greetings from Syncfusion.
When using Type as Action, the complete chip item will behave as a button. Hence the Command will work.
When using Type as Input, we will get the close button. For that close button we have close event. By using the EventToCommand behaviour we can use the command as given below.
EventToCommand behavior link: https://github.com/xamarin/xamarin-forms-samples/tree/master/Behaviors/EventToCommandBehavior
Code snippet:
<FlexLayout.Behaviors>
<local:EventToCommandBehavior EventName="ChildRemoved" Command="{Binding ClickCommand}" />
</FlexLayout.Behaviors>
Please let us know if you need any clarification on this.
Regards,Selva Kumar V.
employees.CollectionChanged += Employees_CollectionChanged;
private void Employees_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove) { var removeditem = e.OldItems[0] as EmployeeDetails; } } |
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)
{
}
} |