Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142841 | Feb 21,2019 02:52 PM UTC | May 1,2020 03:38 PM UTC | Xamarin.Forms | 13 |
![]() |
Tags: SfChipGroup |
<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)
{
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.