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
close icon

Is it possible to have all items collapsed?

I have this SfAccordion, but the first item is always open. Can I have all of them collapsed on init?

<accordion:SfAccordion
                x:Name="Accordion"
                BindableLayout.ItemsSource="{Binding Products}">
                <BindableLayout.ItemTemplate>
                    <DataTemplate>
                        <accordion:AccordionItem>
                            <accordion:AccordionItem.Header>
                                     <Label Text="Text Header" />
                            </accordion:AccordionItem.Header>
                            <accordion:AccordionItem.Content>
                                     <Label Text="Text Content" />
                            </accordion:AccordionItem.Content>
                        </accordion:AccordionItem>
                    </DataTemplate>
                </BindableLayout.ItemTemplate>
            </accordion:SfAccordion>

1 Reply

LN Lakshmi Natarajan Syncfusion Team January 6, 2020 09:34 AM UTC

Hi Santiago, 
  
Thank you for using Syncfusion products. 
  
We have checked the reported query. We would like to let you know that Accordion allows you to load all the items in the collapsed state. You can achieve this requirement by setting the ExpandMode property as SingleOrNone. 
  
API details: 
  
Enum 
Description 
Single 
Expands one AccordionItem 
SingleOrNone 
Expands one AccordionItem or none 
Multiple 
Expands multiple AccordionItems 
MultipleOrNone 
Expands multiple AccordionItems or none 
  
Xaml: 
  
<accordion:SfAccordion x:Name="Accordion" 
                           ExpandMode="SingleOrNone" 
                           BindableLayout.ItemsSource="{Binding Products}"/> 
  
C#: 
  
  SfAccordion accordion = new SfAccordion(); 
  accordion.ExpandMode = ExpandMode.SingleOrNone; 
  
Note: The default value for the ExpandMode property is Single. 
  
Please let us know if you would require any further assistance. 
  
Regards, 
Lakshmi Natarajan 


Loader.
Live Chat Icon For mobile
Up arrow icon