2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
You can show or hide the AccoridonItem in Xamarin.Forms SfAccordion by handling the ViewModel bound collection with add or remove action. C# OnHideOrShow handler is used to show or hide the particular AccordionItem by updating the collection. public class BehaviorClass : Behavior<ContentPage> { Contact deletedItem = null; SfAccordion accordion; Button HideOrShow; protected override void OnAttachedTo(ContentPage bindable) { base.OnAttachedTo(bindable); accordion = bindable.FindByName<SfAccordion>("Accordion"); HideOrShow = bindable.FindByName<Button>("HideOrShow"); HideOrShow.Clicked += OnHideOrShow; } private void OnHideOrShow(object sender, EventArgs e) { var items = (sender as Button).BindingContext as ViewModel; if (deletedItem == null) { deletedItem = items.ContactsInfo[2]; items.ContactsInfo.RemoveAt(2); } else { items.ContactsInfo.Insert(2, deletedItem); deletedItem = null; } } } Output |
2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.