menu

MAUI

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

    Show / Hide Table of Contents

    Class SfExpander

    Represents a collapsible container that can be expanded or collapsed to show or hide its content.

    Inheritance
    System.Object
    SfView
    SfExpander
    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.ArrangeOverride(Rect)
    SfView.Children
    SfView.ClipToBounds
    SfView.GetSemanticsNodesCore(Double, Double)
    SfView.IDrawableLayout.DrawingOrder
    SfView.IDrawableLayout.InvalidateDrawable()
    SfView.MeasureOverride(Double, Double)
    SfView.OnBindingContextChanged()
    SfView.OnDraw(ICanvas, RectF)
    SfView.Padding
    Namespace: Syncfusion.Maui.Expander
    Assembly: Syncfusion.Maui.Expander.dll
    Syntax
    public class SfExpander : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, IParentThemeElement, IThemeElement

    Constructors

    SfExpander()

    Initializes a new instance of the SfExpander class.

    Declaration
    public SfExpander()

    Fields

    AnimationDurationProperty

    Identifies the AnimationDuration bindable property.

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

    AnimationEasingProperty

    Identifies the AnimationEasing bindable property.

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

    ContentProperty

    Identifies the Content bindable property.

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

    HeaderBackgroundProperty

    Identifies the HeaderBackground bindable property.

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

    HeaderIconColorProperty

    Identifies the HeaderIconColor bindable property.

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

    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.

    HeaderProperty

    Identifies the Header bindable property.

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

    This bindable property is read-only.

    IsExpandedProperty

    Identifies the IsExpanded bindable property.

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

    This bindable property is read-only.

    Properties

    AnimationDuration

    Gets or sets the duration of the expand and collapse animation in milliseconds.

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

    Default value is 200ms.

    Remarks

    The AnimationDuration property specifies the time it takes for an animation to complete its full cycle.It is measured in milliseconds(ms).

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

    AnimationEasing

    Gets or sets the ExpanderAnimationEasing function for an expand and collapse animation.

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

    The type of animation that specifies the rate of change of parameter over time or animation style of the expander.

    Remarks

    Set this property as None to disable the animation for SfExpander.

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

    Content

    Gets or sets the content to be displayed when the SfExpander is expanded.

    Declaration
    public View Content { get; set; }
    Property Value
    Type
    Microsoft.Maui.Controls.View
    Examples
     <syncfusion:SfExpander.Content>
          <Grid>
             <Label Text ="Veg pizza is prepared with the items that meet vegetarian standards by not including any meat or animal tissue products."
                  VerticalTextAlignment="Center"/>
          </Grid>
     </syncfusion:SfExpander.Content>
    See Also
    Header

    Header

    Gets or sets the view that is displayed in the header of the SfExpander.

    Declaration
    public View Header { get; set; }
    Property Value
    Type
    Microsoft.Maui.Controls.View
    Examples
     <syncfusion:SfExpander.Header>
           <Grid>
                <Label Text="Veg Pizza" VerticalTextAlignment="Center" />
           <Grid>
     </syncfusion:SfExpander.Header>
    See Also
    Content

    HeaderBackground

    Gets or sets the background color of the header area in the SfExpander control.

    Declaration
    public Brush HeaderBackground { get; set; }
    Property Value
    Type
    Microsoft.Maui.Controls.Brush
    Examples
     <syncfusion:SfExpander HeaderBackground ="Red">
     </syncfusion:SfExpander>
    See Also
    HeaderIconPosition
    HeaderIconColor

    HeaderIconColor

    Gets or sets the color of the header icon in the SfExpander control.

    Declaration
    public Color HeaderIconColor { get; set; }
    Property Value
    Type
    Microsoft.Maui.Graphics.Color
    Examples
     <syncfusion:SfExpander HeaderIconColor  ="Red">
     </syncfusion:SfExpander>
    See Also
    HeaderIconPosition
    HeaderBackground

    HeaderIconPosition

    Gets or sets the ExpanderIconPosition of the header icon in the SfExpander control.

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

    The default value is End.

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

    IsExpanded

    Gets or sets a value indicating whether the SfExpander control's content is expanded.

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

    The IsExpanded property determines whether the content of the Expander control is displayed expanded or collapsed. When set to true, the content is displayed expanded; when set to false, the content is displayed collapsed.

    Methods

    AnimationCompleted()

    Triggers after the animation has been completed.

    Declaration
    protected virtual void AnimationCompleted()

    ArrangeContent(Rect)

    Arrange the child views in Expander.

    Declaration
    protected override Size ArrangeContent(Rect bounds)
    Parameters
    Type Name Description
    Microsoft.Maui.Graphics.Rect bounds

    Bounds of Expander.

    Returns
    Type Description
    Microsoft.Maui.Graphics.Size

    Returns the required size to arrange Expander.

    Overrides
    SfView.ArrangeContent(Rect)

    ChangeVisualState()

    Helps to trigger the VisualState initially when View is loaded.

    Declaration
    protected override void ChangeVisualState()

    MeasureContent(Double, Double)

    Measure the child views in Expander.

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

    Width of Expander.

    System.Double heightConstraint

    Height of Expander.

    Returns
    Type Description
    Microsoft.Maui.Graphics.Size

    Returns measured size of Expander.

    Overrides
    SfView.MeasureContent(Double, Double)

    OnHandlerChanged()

    Raised when handler gets changed.

    Declaration
    protected override void OnHandlerChanged()
    Overrides
    SfView.OnHandlerChanged()

    OnPropertyChanged(String)

    Need to handle the run time changes of of SfExpander.

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

    Represents the property changed event arguments.

    RaiseCollapsedEvent()

    Raises the Collapsed event.

    Declaration
    protected virtual void RaiseCollapsedEvent()

    RaiseCollapsingEvent()

    Raises the Collapsing event.

    Declaration
    protected virtual void RaiseCollapsingEvent()

    RaiseExpandedEvent()

    Raises the Expanded event.

    Declaration
    protected virtual void RaiseExpandedEvent()

    RaiseExpandingEvent()

    Raises the Expanding event.

    Declaration
    protected virtual void RaiseExpandingEvent()

    Events

    Collapsed

    Occurs when the SfExpander control is collapsed.

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

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

    Examples
    expander.Collapsed += Expander_Collapsed;
    private void Expander_Collapsed(object sender, ExpandedAndCollapsedEventArgs e)
    {
        expander.HeaderBackground = Color.Aqua;
    }
    See Also
    Expanding
    Expanded
    Collapsing

    Collapsing

    Occurs when the SfExpander control is being collapsed.

    Declaration
    public event EventHandler<ExpandingAndCollapsingEventArgs> Collapsing
    Event Type
    Type
    System.EventHandler<ExpandingAndCollapsingEventArgs>
    Examples
    expander.Collapsing += Expander_Collapsing;
    private void Expander_Collapsing(object sender, ExpandingAndCollapsingEventArgs e)
    {
        // Below code cancels the collapsing operation of the SfExpander control.
        e.Cancel = true;
    }
    See Also
    Expanding
    Expanded
    Collapsed

    Expanded

    Occurs when the SfExpander control 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
    expander.Expanded += Expander_Expanded;
    private void Expander_Expanded(object sender, ExpandedAndCollapsedEventArgs e)
    {
        expander.HeaderBackground = Color.YellowGreen;
    }
    See Also
    Expanding
    Collapsed
    Collapsing

    Expanding

    Occurs when the SfExpander control is being expanded.

    Declaration
    public event EventHandler<ExpandingAndCollapsingEventArgs> Expanding
    Event Type
    Type
    System.EventHandler<ExpandingAndCollapsingEventArgs>
    Examples
    expander.Expanding += Expander_Expanding;
    private void Expander_Expanding(object sender, ExpandingAndCollapsingEventArgs e)
    {
        // Below code cancels the expanding operation of the SfExpander control.
        e.Cancel = true;
    }
    See Also
    Expanded
    Collapsed
    Collapsed

    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