Articles in this section
Category / Section

How to customize the appearance of .Net MAUI SfAccordion?

5 mins read

The appearence of SfAccordion can be customised using the VisualStateManager.

XAML

Defining the VisualStates to Customize Accordion appearence.

  <ContentPage.Content>
        <syncfusion:SfAccordion x:Name="Accordion" ExpandMode="SingleOrNone" BindableLayout.ItemsSource="{Binding Info}">
            <BindableLayout.ItemTemplate>
                <DataTemplate>
                    <syncfusion:AccordionItem x:Name="AccordionItem">
                        <syncfusion:AccordionItem.Header>
                            <Grid HeightRequest="50" Padding="10,0">
                                <Label Text="{Binding Name}" VerticalOptions="Center" HorizontalOptions="Start"/>
                            </Grid>
                        </syncfusion:AccordionItem.Header>
                        <syncfusion:AccordionItem.Content>
                            <Grid BackgroundColor="NavajoWhite" Padding="10">
                                <Label Text="{Binding Description}"/>
                            </Grid>
                        </syncfusion:AccordionItem.Content>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroupList>
                                <VisualStateGroup>
                                    <VisualState Name="Expanded">
                                        <VisualState.Setters>
                                            <Setter Property="HeaderBackground" Value="LightPink"/>
                                            <Setter Property="HeaderIconColor" Value="Red"/>
                                        </VisualState.Setters>
                                    </VisualState>
                                    <VisualState Name="Collapsed">
                                        <VisualState.Setters>
                                            <Setter Property="HeaderBackground" Value="LightGreen"/>
                                            <Setter Property="HeaderIconColor" Value="Blue"/>
                                        </VisualState.Setters>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateGroupList>
                        </VisualStateManager.VisualStateGroups>
                    </syncfusion:AccordionItem>
                </DataTemplate>
            </BindableLayout.ItemTemplate>
        </syncfusion:SfAccordion>
    </ContentPage.Content>

VisualStateManager.gif

Download the sample from GitHub

Conclusion

I hope you enjoyed learning how to customize the appearance of .Net MAUI SfAccordion.
You can refer to our .NET MAUI Accordion feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our .NET MAUI Accordion example to understand how to create and manipulate data.
For current customers, check out our components from the License and Downloads page. If you are new to Syncfusion, try our 30-day free trial to check out our other controls.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied