You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue and 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
The current implementation for expanding and collapsing the Expander is via changing the Expander.Content.IsVisible property from false to true and vice versa which leaves little opportunity to introduce animations. Instead of using the IsVisible property, if the Content was placed inside a StackLayout, say, a VerticalStackLayout, then, we can implement animation by changing the Height of the VerticalStackLayout from 0 (or near zero) to the height of the Content. We do this with these properties:
double ContentHeight get/set property
double MinimumContentHeight get readonly property (which needs to be at least 1, since it doesn't work when it's 0)
double MaximumContentHeight get readonly property
Task<bool> ContentHeightTo(double value) method
Usage Syntax
To use, add a PropertyChanged event handler to your Expander, e.g.
Feature name
Expander update to support animation
Link to discussion
#1628
Progress tracker
Summary
This issue and 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
The current implementation for expanding and collapsing the Expander is via changing the Expander.Content.IsVisible property from false to true and vice versa which leaves little opportunity to introduce animations. Instead of using the IsVisible property, if the Content was placed inside a StackLayout, say, a VerticalStackLayout, then, we can implement animation by changing the Height of the VerticalStackLayout from 0 (or near zero) to the height of the Content. We do this with these properties:
double ContentHeight
get/set propertydouble MinimumContentHeight
get readonly property (which needs to be at least 1, since it doesn't work when it's 0)double MaximumContentHeight
get readonly propertyTask<bool> ContentHeightTo(double value)
methodUsage Syntax
To use, add a
PropertyChanged
event handler to your Expander, e.g.Then, in your code-behind, we invoke the animation when IsExpanded changes, e.g.
Drawbacks
There are several issues encountered:
Alternatives
The animation could be moved to inside the Expander component and we can introduce properties such as:
bool AnimationEnabled (default true)
uint AnimationDuration (default 100)
Easing? AnimationEasing (default null)
Unresolved Questions
No response
The text was updated successfully, but these errors were encountered: