Skip to content

[Proposal] Expander animation #2521

Open

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

Activity

  1. added
    proposalA fully fleshed out proposal describing a new feature in syntactic and semantic detail
    on Feb 14, 2025
  2. crwsolutions commented on Mar 28, 2025

    @crwsolutions

    bool AnimationEnabled (default true)

    +1

    Setting default to false is also fine for me (it might provide a better upgrade path), but I would prefer to simply have a switch that just works.

  3. stephenquan commented on Apr 3, 2025

    @stephenquan
    ContributorAuthor

    From reading the above comments from @crwsolutions as well as #2522 (comment) there seems to be support for one of the solutions that I depicted in the "Alternatives". When there is free time, I will move the current implementation into a branch so that the main branch can be repurposed for this alternate solution.

  4. added
    championA member of the .NET MAUI Toolkit core team has chosen to champion this feature
    approvedThis Proposal has been approved and is ready to be added to the Toolkit
    and removed
    needs discussionDiscuss it on the next Monthly standup
    on Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions