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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Accordion view expand accordion from vm

Thread ID:

Created:

Updated:

Platform:

Replies:

151128 Jan 31,2020 02:18 PM UTC Feb 4,2020 04:45 AM UTC Xamarin.Forms 3
loading
Tags: SfAccordion
Reza Mohamed
Asked On January 31, 2020 02:18 PM UTC

I have an accordion that i am populating data from a viewmodel. How would i expand one accordion from the viewmodel? 

As an example, i am populating an accordion with weekly data sunday - saturday, I want to expand the accordion to whatever day today is, say Tuesday.




Lakshmi Natarajan [Syncfusion]
Replied On February 3, 2020 10:11 AM UTC

Hi Reza, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query from our end. We would like to let you know that you can expand one AccordionItem based on IsExpanded property by using ExpandMode as Single when loaded. Please find the following code snippet for more reference, 
 
Xaml: 
 
<accordion:SfAccordion x:Name="accordion" 
                               BindableLayout.ItemsSource="{Binding Info}"  
                               ExpandMode="Single"> 
            <BindableLayout.ItemTemplate> 
                <DataTemplate> 
                    <accordion:AccordionItem IsExpanded="{Binding IsExpanded}"> 
                        <accordion:AccordionItem.Header> 
                            <Grid> 
                                <Label Grid.Row="0" 
                                        Text="{Binding Name}" 
                                        TextColor="Black" 
                                        FontAttributes="Bold" 
                                        FontSize="20" /> 
                            </Grid> 
                        </accordion:AccordionItem.Header> 
                        <accordion:AccordionItem.Content> 
                            <Grid HeightRequest="50"> 
                                <Label Text="{Binding Description}"/> 
                            </Grid> 
                        </accordion:AccordionItem.Content> 
                    </accordion:AccordionItem> 
                </DataTemplate> 
            </BindableLayout.ItemTemplate> 
        </accordion:SfAccordion> 
 
We have prepared a sample based on your requirement. Please find the sample in the following link, 
 
 
You can also refer our online user guide documentation regarding the same by the following link, 
 
 
We hope this helps. Please let us know if you need any further assistance. 
 
Regards, 
Lakshmi Natarajan 


Reza Mohamed
Replied On February 4, 2020 04:05 AM UTC

Thank you! Exactly what I was needing help with.

Lakshmi Natarajan [Syncfusion]
Replied On February 4, 2020 04:45 AM UTC

Hi Reza, 
 
Thanks for the update. 
  
We are glad that reported issue have been resolved at your end. Please let us know if you need any further update. As always we are happy to help you out. 
 
Regards, 
Lakshmi Natarajan 


CONFIRMATION

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