menu

MAUI Toolkit

  • User Guide
  • Demos
  • Support
Class AccordionItem - MAUI-ToolKit API Reference | Syncfusion

    Show / Hide Table of Contents

    Class AccordionItem

    Represents an item within the SfAccordion control.

    Inheritance
    System.Object
    SfView
    AccordionItem
    Implements
    IDrawableLayout
    Microsoft.Maui.Graphics.IDrawable
    Microsoft.Maui.IAbsoluteLayout
    Microsoft.Maui.ILayout
    Microsoft.Maui.IView
    Microsoft.Maui.IElement
    Microsoft.Maui.ITransform
    Microsoft.Maui.IContainer
    System.Collections.Generic.IList<Microsoft.Maui.IView>
    System.Collections.Generic.ICollection<Microsoft.Maui.IView>
    System.Collections.Generic.IEnumerable<Microsoft.Maui.IView>
    System.Collections.IEnumerable
    Microsoft.Maui.ISafeAreaView
    Microsoft.Maui.IPadding
    Microsoft.Maui.ICrossPlatformLayout
    Microsoft.Maui.IVisualTreeElement
    Inherited Members
    SfView.Children
    SfView.ClipToBounds
    SfView.Padding
    Namespace: Syncfusion.Maui.Toolkit.Accordion
    Assembly: Syncfusion.Maui.Toolkit.dll
    Syntax
    public class AccordionItem : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, IThemeElement

    Constructors

    AccordionItem()

    Declaration
    public AccordionItem()

    Fields

    ContentProperty

    Identifies the Content bindable property.

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

    The ContentProperty determines the content displayed within the control.

    HeaderBackgroundProperty

    Identifies the HeaderBackground bindable property.

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

    The HeaderBackgroundProperty determines the background appearance of the header.

    HeaderIconColorProperty

    Identifies the HeaderIconColor bindable property.

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

    The HeaderIconColorProperty determines the color of the icon displayed in the header.

    HeaderProperty

    Identifies the Header bindable property.

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

    The HeaderProperty determines the appearance of the header.

    IsExpandedProperty

    Identifies the IsExpanded bindable property.

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

    The IsExpandedProperty determines whether the control is currently expanded or collapsed.

    Properties

    Content

    Gets or sets the view that represents the content of the AccordionItem.

    Declaration
    public View Content { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.View

    It accepts a Microsoft.Maui.Controls.View. The default value is null.

    Remarks

    This property allows you to define the content displayed when the accordion item is expanded.

    Examples

    Here is an example of how to set the Content property for an AccordionItem:

    • XAML
    • C#
    <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>
    var accordionItem = new AccordionItem();
    var grid = new Grid
    {
        Padding = new Thickness(10, 10, 10, 10),
        BackgroundColor = Colors.White
    };
    var label = new Label
    {
        TextColor = Color.FromHex("#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 = TextAlignment.Center
    };
    grid.Children.Add(label);
    accordionItem.Content = grid;
    See Also
    Header

    Header

    Gets or sets the custom view that represents the header of the AccordionItem.

    Declaration
    public View Header { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.View

    A Microsoft.Maui.Controls.View that defines the appearance of the header. The default value is null.

    Remarks

    By default, the header of an AccordionItem can be customized to display any view as per the requirement.

    Examples

    Here is an example of how to set the Header property

    • XAML
    • C#
    <syncfusion:AccordionItem.Header>
        <Grid>
            <Label TextColor="#495F6E"
                   Text="Cheese burger"
                   HeightRequest="50"
                   VerticalTextAlignment="Center" />
        </Grid>
    </syncfusion:AccordionItem.Header>
    var accordionItem = new AccordionItem();
    var grid = new Grid();
    var label = new Label
    {
    	TextColor = Color.FromArgb("#495F6E"),
    	Text = "Cheese burger",
    	HeightRequest = 50,
    	VerticalTextAlignment = TextAlignment.Center
    };
    grid.Children.Add(label);
    accordionItem.Header = grid;
    See Also
    Content

    HeaderBackground

    Gets or sets the background color of the header in the AccordionItem.

    Declaration
    public Brush HeaderBackground { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    It accepts a Microsoft.Maui.Graphics.Color value. The default value is Color.FromArgb("#00000000").

    Remarks

    This property allows you to customize the color appearance of the accordion header.

    Examples

    Here is an example of how to set the HeaderBackground property:

    • XAML
    • C#
    <syncfusion:SfAccordion>
        <syncfusion:SfAccordion.Items>
            <syncfusion:AccordionItem HeaderBackground="LightBlue">
                <!-- Header and Content definitions -->
            </syncfusion:AccordionItem>
        </syncfusion:SfAccordion.Items>
    </syncfusion:SfAccordion>
    var accordionItem = new AccordionItem
    {
        HeaderBackground = Colors.LightBlue
    };
    // Define the header and content for the accordion item here
    See Also
    HeaderIconColor

    HeaderIconColor

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

    Declaration
    public Color HeaderIconColor { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Graphics.Color

    It accepts a Microsoft.Maui.Graphics.Color value. The default value is Color.FromArgb("#49454F").

    Remarks

    This property allows you to customize the color of the icon displayed in the header of the accordion item.

    Examples

    Here is an example of how to set the HeaderIconColor property:

    • XAML
    • C#
    <syncfusion:SfAccordion>
        <syncfusion:SfAccordion.Items>
            <syncfusion:AccordionItem HeaderIconColor="DarkRed">
                <!-- Header and Content definitions -->
            </syncfusion:AccordionItem>
        </syncfusion:SfAccordion.Items>
    </syncfusion:SfAccordion>
    var accordionItem = new AccordionItem
    {
        HeaderIconColor = Color.DarkRed
    };
    // Define the header and content for the accordion item here
    See Also
    HeaderBackground

    IsExpanded

    Gets or sets a value indicating whether the AccordionItem is expanded or collapsed.

    Declaration
    public bool IsExpanded { get; set; }
    Property Value
    Type Description
    System.Boolean

    It accepts System.Boolean. The default value is false.

    Remarks

    This property controls the expanded state of the accordion item. When set to true, the item's content is shown, and when set to false, the content is hidden.

    Examples

    Here is an example of how to set the IsExpanded property:

    • XAML
    • C#
    <syncfusion:SfAccordion>
        <syncfusion:SfAccordion.Items>
            <syncfusion:AccordionItem IsExpanded="True">
                <!-- Header and Content definitions -->
            </syncfusion:AccordionItem>
        </syncfusion:SfAccordion.Items>
    </syncfusion:SfAccordion>
    var accordionItem = new AccordionItem
    {
        IsExpanded = true
    };
    // Define the header and content for the accordion item here.

    Methods

    ChangeVisualState()

    Changes the visual state of the current object.

    Declaration
    protected override void ChangeVisualState()
    Remarks

    This method overrides the base implementation to update the visual state based on the current state of this object.

    OnBindingContextChanged()

    Handles the event when the binding context changes for this object.

    Declaration
    protected override void OnBindingContextChanged()
    Overrides
    Syncfusion.Maui.Toolkit.SfView.OnBindingContextChanged()
    Remarks

    This method updates the binding context of the Header and Content properties to match the new binding context of this object.

    OnCommonThemeChanged(String, String)

    Method invokes at whenever common theme changes.

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

    Represents the old theme.

    System.String newTheme

    Represents the new theme.

    OnControlThemeChanged(String, String)

    Method invokes when control theme changes.

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

    Represents the old theme.

    System.String newTheme

    Represents the new theme.

    Implements

    IDrawableLayout
    Microsoft.Maui.Graphics.IDrawable
    Microsoft.Maui.IAbsoluteLayout
    Microsoft.Maui.ILayout
    Microsoft.Maui.IView
    Microsoft.Maui.IElement
    Microsoft.Maui.ITransform
    Microsoft.Maui.IContainer
    System.Collections.Generic.IList<>
    System.Collections.Generic.ICollection<>
    System.Collections.Generic.IEnumerable<>
    System.Collections.IEnumerable
    Microsoft.Maui.ISafeAreaView
    Microsoft.Maui.IPadding
    Microsoft.Maui.ICrossPlatformLayout
    Microsoft.Maui.IVisualTreeElement
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved