menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfAccordion - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfAccordion

    Represents a collapsible accordion control that displays a list of expandable items.

    Inheritance
    System.Object
    AccordionLayout
    SfAccordion
    Inherited Members
    AccordionLayout.InvalidateMeasure()
    Namespace: Syncfusion.Maui.Accordion
    Assembly: Syncfusion.Maui.Expander.dll
    Syntax
    public class SfAccordion : AccordionLayout, IParentThemeElement, IThemeElement, IKeyboardListener
    Remarks

    The SfAccordion control allows you to organize content into collapsible sections called items. Each item can be expanded or collapsed to show or hide its associated content.

    Constructors

    SfAccordion()

    Initializes a new instance of the SfAccordion class and initialize the default values of this members.

    Declaration
    public SfAccordion()

    Fields

    AnimationDurationProperty

    Identifies the AnimationDuration bindable property.

    Declaration
    public static readonly BindableProperty AnimationDurationProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    AnimationEasingProperty

    Identifies the AnimationEasing bindable property.

    Declaration
    public static readonly BindableProperty AnimationEasingProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    AutoScrollPositionProperty

    Identifies the AutoScrollPosition bindable property.

    Declaration
    public static readonly BindableProperty AutoScrollPositionProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ExpandModeProperty

    Identifies the ExpandMode bindable property.

    Declaration
    public static readonly BindableProperty ExpandModeProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    HeaderIconPositionProperty

    Identifies the HeaderIconPosition bindable property.

    Declaration
    public static readonly BindableProperty HeaderIconPositionProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ItemSpacingProperty

    Identifies the ItemSpacing bindable property.

    Declaration
    public static readonly BindableProperty ItemSpacingProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    ItemsProperty

    Identifies the Items bindable property.

    Declaration
    public static readonly BindableProperty ItemsProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    This bindable property is read-only.

    Properties

    AnimationDuration

    Gets or sets the duration of the animation when expanding or collapsing the AccordionItem.

    Declaration
    public double AnimationDuration { get; set; }
    Property Value
    Type Description
    System.Double

    The default value is 200 milliseconds.

    Examples
    <syncfusion:SfAccordion AnimationDuration="1000">
    </syncfusion:SfAccordion>
    See Also
    AnimationEasing

    AnimationEasing

    Gets or sets the ExpanderAnimationEasing function applied to the animation when expanding or collapsing an item in the accordion.

    Declaration
    public ExpanderAnimationEasing AnimationEasing { get; set; }
    Property Value
    Type Description
    ExpanderAnimationEasing

    The default value is Linear.

    Remarks

    An easing function specifies the rate of change of a parameter over time. It controls the acceleration and deceleration of the animation.

    Examples
    <syncfusion:SfAccordion AnimationEasing="SinIn">
    </syncfusion:SfAccordion>
    See Also
    AnimationDuration

    AutoScrollPosition

    Gets or sets the value to specify the scroll position of the expanded AccordionItem.

    Declaration
    public AccordionAutoScrollPosition AutoScrollPosition { get; set; }
    Property Value
    Type Description
    AccordionAutoScrollPosition

    The default value is MakeVisible.

    ExpandMode

    Gets or sets a value that indicates whether an end-user can expand single or multiple accordion items.

    Declaration
    public AccordionExpandMode ExpandMode { get; set; }
    Property Value
    Type Description
    AccordionExpandMode

    The value that organize the expand and collapse state of the accordion items. The default value is Single.

    Examples
    accordion.ExpandMode = AccordionExpandMode.Multiple;

    HeaderIconPosition

    Gets or sets the ExpanderIconPosition of the header icon in the AccordionItem.

    Declaration
    public ExpanderIconPosition HeaderIconPosition { get; set; }
    Property Value
    Type Description
    ExpanderIconPosition

    The default value is End.

    Examples
    <syncfusion:SfAccordion HeaderIconPosition="Start">
    </syncfusion:SfAccordion>
    See Also
    HeaderIconColor
    HeaderBackground

    Items

    Gets or sets the collection of AccordionItem in the SfAccordion control.

    Declaration
    public ObservableCollection<AccordionItem> Items { get; set; }
    Property Value
    Type
    System.Collections.ObjectModel.ObservableCollection<AccordionItem>
    Examples
    <syncfusion:SfAccordion>
        <syncfusion:SfAccordion.Items>
            <syncfusion:AccordionItem>
                <syncfusion:AccordionItem.Header>
                    <Grid>
                        <Label TextColor ="#495F6E"
                               Text ="Cheese burger"
                               HeightRequest="50"
                               VerticalTextAlignment="Center" />
                       </Grid>
                 </syncfusion:AccordionItem.Header>
                 <syncfusion:AccordionItem.Content>
                    <Grid Padding = "10,10,10,10"
                            BackgroundColor="#FFFFFF">
                        <Label TextColor = "#303030"
                               Text="Hamburger accompanied with melted cheese. The term itself is a portmanteau of the words cheese and hamburger. The cheese is usually sliced, then added a short time before the hamburger finishes cooking to allow it to melt."
                               VerticalTextAlignment="Center" />
                    </Grid>
                 </syncfusion:AccordionItem.Content>
             </syncfusion:AccordionItem>
         </syncfusion:SfAccordion.Items>
    </syncfusion:SfAccordion>

    ItemSpacing

    Gets or sets the spacing between the items in the SfAccordion.

    Declaration
    public double ItemSpacing { get; set; }
    Property Value
    Type Description
    System.Double

    The default value is 6.0d.

    Methods

    BringIntoView(AccordionItem)

    Attempts to bring the accordion item into view by scrolling.

    Declaration
    public void BringIntoView(AccordionItem item)
    Parameters
    Type Name Description
    AccordionItem item

    Represents the AccordionItem to scroll.

    CreateLayoutManager()

    Method used to create the accordion layout manager.

    Declaration
    protected override ILayoutManager CreateLayoutManager()
    Returns
    Type Description
    Microsoft.Maui.Layouts.ILayoutManager

    The accordion layout manager.

    MeasureOverride(Double, Double)

    Meathod used to measure the accordion layout children based on width and height value.

    Declaration
    protected override Size MeasureOverride(double widthConstraint, double heightConstraint)
    Parameters
    Type Name Description
    System.Double widthConstraint

    The maximum width request of the layout.

    System.Double heightConstraint

    The maximum height request of the layout.

    Returns
    Type Description
    Microsoft.Maui.Graphics.Size

    The required size of the layout.

    OnChildAdded(Element)

    Add child elements.

    Declaration
    protected override void OnChildAdded(Element child)
    Parameters
    Type Name Description
    Microsoft.Maui.Controls.Element child

    Represents the child element to be added.

    OnCommonThemeChanged(String, String)

    Method invoke when theme dictionary contains syncfusion theme.

    Declaration
    public void OnCommonThemeChanged(string oldTheme, string newTheme)
    Parameters
    Type Name Description
    System.String oldTheme

    Old theme name.

    System.String newTheme

    New theme name.

    OnControlThemeChanged(String, String)

    Method invoke when theme changes are applied for internal properties.

    Declaration
    public void OnControlThemeChanged(string oldTheme, string newTheme)
    Parameters
    Type Name Description
    System.String oldTheme

    Old theme name.

    System.String newTheme

    New theme name.

    OnHandlerChanged()

    Raised when handler gets changed.

    Declaration
    protected override void OnHandlerChanged()

    OnPropertyChanged(String)

    Need to handle the run time changes of of SfAccordion.

    Declaration
    protected override void OnPropertyChanged(string propertyName = null)
    Parameters
    Type Name Description
    System.String propertyName

    Represents the property changed event arguments.

    RaiseCollapsedEvent(Int32)

    Raises the Collapsed event.

    Declaration
    protected void RaiseCollapsedEvent(int index)
    Parameters
    Type Name Description
    System.Int32 index

    Index of AccordionItem.

    RaiseCollapsingEvent(Int32)

    Raised Collapsing event.

    Declaration
    protected bool RaiseCollapsingEvent(int index)
    Parameters
    Type Name Description
    System.Int32 index

    Index of AccordionItem.

    Returns
    Type Description
    System.Boolean

    Returns true if collapsing event is not triggered else inverse of ExpandingAndCollapsingEventArgs.Cancel value.

    RaiseExpandedEvent(Int32)

    Raises the Expanded event.

    Declaration
    protected void RaiseExpandedEvent(int index)
    Parameters
    Type Name Description
    System.Int32 index

    Index of AccordionItem.

    RaiseExpandingEvent(Int32)

    Raised Expanding event.

    Declaration
    protected bool RaiseExpandingEvent(int index)
    Parameters
    Type Name Description
    System.Int32 index

    Index of AccordionItem.

    Returns
    Type Description
    System.Boolean

    Returns true if expanding event is not triggered else inverse of ExpandingAndCollapsingEventArgs.Cancel value.

    Events

    Collapsed

    Occurs when an AccordionItem is collapsed.

    Declaration
    public event EventHandler<ExpandedAndCollapsedEventArgs> Collapsed
    Event Type
    Type
    System.EventHandler<ExpandedAndCollapsedEventArgs>
    Examples
    accordion.Collapsed += OnAccordionCollapsed;
    private void OnAccordionCollapsed(object sender, ExpandedAndCollapsedEventArgs e)
    {
        var index = e.Index;
    }
    See Also
    Collapsing
    Expanding
    Expanded

    Collapsing

    Occurs when an AccordionItem is being collapsed in the SfAccordion control.

    Declaration
    public event EventHandler<ExpandingAndCollapsingEventArgs> Collapsing
    Event Type
    Type
    System.EventHandler<ExpandingAndCollapsingEventArgs>
    Remarks

    The user can control the collapsing of content by using ExpandingAndCollapsingEventArgs of this event. If the Cancel property is set to true in the event's handler, the execution of the current event is cancelled.

    Examples
    accordion.Collapsing += OnAccordionCollapsing;
    private void OnAccordionCollapsing(object sender, ExpandingAndCollapsingEventArgs e)
    {
        e.Cancel = true;
    }
    See Also
    Collapsed
    Expanding
    Expanded

    Expanded

    Occurs when an AccordionItem is expanded.

    Declaration
    public event EventHandler<ExpandedAndCollapsedEventArgs> Expanded
    Event Type
    Type
    System.EventHandler<ExpandedAndCollapsedEventArgs>
    Remarks

    The event handler receives an argument of type ExpandingAndCollapsingEventArgs containing data related to this event.

    Examples
    accordion.Expanded += OnAccordionExpanded;
    private void OnAccordionExpanded(object sender, ExpandedAndCollapsedEventArgs e)
    {
       var index = e.Index;
    }
    See Also
    Expanding
    Collapsed
    Collapsing

    Expanding

    Occurs when an AccordionItem is being expanded in the SfAccordion control.

    Declaration
    public event EventHandler<ExpandingAndCollapsingEventArgs> Expanding
    Event Type
    Type
    System.EventHandler<ExpandingAndCollapsingEventArgs>
    Remarks

    The user can control the expanding of content by using ExpandingAndCollapsingEventArgs of this event. If the Cancel property is set to true in the event's handler, the execution of the current event is cancelled.

    Examples
    accordion.Expanding += OnAccordionExpanding;
    private void OnAccordionExpanding(object sender, ExpandingAndCollapsingEventArgs e)
    {
        var index = e.Index;
        e.Cancel = true;
    }
    See Also
    Expanded
    Collapsed
    Collapsing
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved