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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfAccordion Manually Collapse from codebehind

Thread ID:





149826 Dec 11,2019 08:19 AM UTC Dec 16,2019 05:38 AM UTC Xamarin.Forms 4
Tags: SfAccordion
Asked On December 11, 2019 08:19 AM UTC


Is there is a way to collapse the content of selected item from code behind?

I have a button in the accordion content and i want to collapse the selected item after finishing its task from MVVC , i do every thing and task run successfully and the accordion header updated succesfully with the updated data , i just need to fire collapse event of this item after finishing the task;


Gnana Priya Namasivayam [Syncfusion]
Replied On December 12, 2019 04:37 PM UTC

Hi Mohammed, 
Thanks for using Syncfusion product. 
Currently, we are validating the reported query from our side. We will validate and provide you further details on December 13,2019. We will appreciate your patience until then. 
Gnana Priya N 

Gnana Priya Namasivayam [Syncfusion]
Replied On December 13, 2019 01:53 PM UTC

Hi Mohammed, 
We would like to inform that you can achieve your requirement binding the IsExpand property of AccordionItem like below. We have attached the model sample based on your requirement. Kindly find the sample and code snippet from below. 
<syncfusion:SfAccordion x:Name="Accordion" ExpandMode="MultipleOrNone" BindableLayout.ItemsSource="{Binding Info}"> 
                <syncfusion:AccordionItem IsExpanded="{Binding IsExpand}"> 
                        <Label Text="{Binding Name}"/> 
                                <RowDefinition Height="50"/> 
                                <RowDefinition Height="50"/> 
                        <Label Text="{Binding Description}"/> 
                            <Button x:Name="btn" Grid.Row="1" Text="{Binding Name}" Command="{Binding Path=BindingContext.ButtonCommand, Source={x:Reference Accordion}}" CommandParameter="{x:Reference btn}"/> 
public class ItemInfoRepository : INotifyPropertyChanged 
        public ObservableCollection<ItemInfo> Info { get; set; } 
        public Command<object> ButtonCommand { get; set; } 
        public ItemInfoRepository() 
            Info = new ObservableCollection<ItemInfo>(); 
            ButtonCommand = new Command<object>(OnButtonTapped); 
        private void OnButtonTapped(object obj) 
            var item = (obj as Button).BindingContext as ItemInfo; 
            item.IsExpand = !item.IsExpand; 
Please let us know whether sample meets your requirement. 
Gnana Priya N 

Replied On December 13, 2019 06:08 PM UTC


Thanks alot the sample works and your solustion is just PERFECT for me thanks, that what i was looking  for.

Gnana Priya Namasivayam [Syncfusion]
Replied On December 16, 2019 05:38 AM UTC

Hi Mohammed, 
Thanks for the update. 
We are glad that reported issue have been fixed in your application. Please let us know if you need any further assistance from us. 
Gnana Priya N 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon