This repository has been archived by the owner on May 1, 2024. It is now read-only.
Spec: Visual State Manager Improvements #4232
Labels
a/VSM
help wanted
We welcome community contributions to any issue, but these might be a good place to start!
in-progress
This issue has an associated pull request that may resolve it!
inactive
Issue is older than 6 months and needs to be retested
proposal-accepted
t/enhancement ➕
up-for-grabs
We welcome community contributions to any issue, but these might be a good place to start!
Drafted by @rmarinho
Rationale
Xamarin.Forms 3.0 introduced VisualStateManager. This proposal is to add support for states, triggers, and provide a foundation for animations.
VSM should make easy to activate states from XAML, for this we could introduce the concept of a
StateTrigger
, a state trigger activates the attached state depending of a number conditions, we could have builtinAdaptiveTrigger
where we activate a state depending on features like screen size or orientation, or aEventStateTrigger
that could activate a state when a event is fired and deactivate when other event is fired. We already have this kind of concept and a existingEventTigger
andTriggerbase
.That way the user doesn't have to call the GoToState on code behind. A StateTrigger should only apply when all conditions are met, if any of the conditions isn't met all the modifications to the properties made by the corresponding VisualState are automatically removed and the values provided initally take effect.
VSM should support more out of the box states for each of the Views like Button, Entry, Editor, ListView
VisualState should provide a way to execute animations instead of just setting properties on the elements. We should consider extend
Animation
or to introduce the a new api likeStoryboard
(similar to Animation but for XAML usage)It's important this works with OnPlatform also.
Implementation
XAML Sample
Android
iOS
UWP
MacOS
GTK
Implications for CSS
We could try to map media queries to
AdaptiveTriggers
but I think this is out of the scope for this spec.Backward Compatibility
There should be no changes to the existing usage of VSM without triggers, transitions or animations.
Using none of the new features should just work as before.
Difficulty : Medium
The text was updated successfully, but these errors were encountered: