Skip to content

[Proposal] Expander animation #2521

@stephenquan

Description

@stephenquan

Feature name

Expander updated to support animation via a new ExpanderAnimationBehavior

public partial class ExpanderAnimationBehavior : BaseBehavior<Views.Expander>, IExpansionController
{
    [BindableProperty] public partial Easing CollapsingEasing { get; set; } = Easing.Linear;
    [BindableProperty] public partial uint CollapsingLength { get; set; } = 250u;
    [BindableProperty] public partial Easing ExpandingEasing { get; set; } = Easing.Linear;
    [BindableProperty] public partial uint ExpandingLength { get; set; } = 250u;
    // ...
}

Link to discussion

#1628

Progress tracker

  • Android Implementation
  • iOS Implementation
  • MacCatalyst Implementation
  • Windows Implementation
  • Tizen Implementation
  • Unit Tests
  • Samples
  • Documentation (TODO)

Summary

This issue and the corresponding PR is to continue a conversation that started in the discussion forums on how we may introduce animations to the Expander component.

Motivation

The Expander component could be improved to support animation.

Detailed Design

[Feb 15, 2025, Original Design]
[April 5, 2025, Refactor/Rewrite]

[March 2, 2026, Refactor/Rewrite]

Wrap the user's Expander.Content inside a new Expander.ContentHost (ContentView) so that we can implement expanding/collapsing animation by manipulating Expander.ContentHost.HeightRequest.

Usage:

<toolkit:Expander>
    <!-- Expander.Header -->
    <toolkit:Expander.Behaviors>
        <toolkit:ExpanderAnimationBehavior>
    </toolkit:Expander.Behaviors>
    <!-- Expander.Content -->
</toolkit:Expander>

Drawbacks

No response

Unresolved Questions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    approvedThis Proposal has been approved and is ready to be added to the ToolkitchampionA member of the .NET MAUI Toolkit core team has chosen to champion this featureproposalA fully fleshed out proposal describing a new feature in syntactic and semantic detail

    Type

    No type

    Projects

    Status

    Proposal Approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions