-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StateContainer, Add ChangeStateWithAnimation()
#1021
Conversation
Hey Vlad! The experience described in the Issue is the expected behavior. We added https://learn.microsoft.com/dotnet/communitytoolkit/maui/layouts/statecontainer#viewmodel |
The fix for #942 should be specific to resizing the Window on WinUI and not remove the |
ChangeStateWithAnimation()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Vlad!
I added some tests to ensure/verify that the user can't change CurrentState
while the animations are running.
Check out the code I added to ensure it looks good.
I'll approve this, and if you think it looks good, you can go ahead and merge it 🙌
@bijington Are you able to help update the docs for this PR? I've added
do not merge
Removed APIsStateContainer.ShouldAnimateOnStateChangeProperty Added APIs/// <summary>
/// Change state with custom animation.
/// </summary>
public static async Task ChangeStateWithAnimation(
BindableObject bindable,
string? state,
Animation? beforeStateChange,
Animation? afterStateChange,
CancellationToken token);
/// <summary>
/// Change state with custom animation.
/// </summary>
public static async Task ChangeStateWithAnimation(
BindableObject bindable,
string? state,
Func<VisualElement, CancellationToken, Task>? beforeStateChange,
Func<VisualElement, CancellationToken, Task>? afterStateChange,
CancellationToken cancellationToken);
/// <summary>
/// Change state using the default fade animation.
/// </summary>
public static async Task ChangeStateWithAnimation(BindableObject bindable, string? state, CancellationToken token); |
^ FYI @jfversluis This is a breaking change that we'll need to note in the release notes for v5.0.0 |
@brminnick , @bijington new docs: MicrosoftDocs/CommunityToolkit#235 |
Thanks guys really appreciate your work. |
Description of Change
Instead of throwing exceptions, just return. The animation operation is canceled but we still can continue going to the next state.
Linked Issues
StateContainer.ChangeStateWithAnimation()
API #1027PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information