Skip to content
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

Make IsToggled change animated #71

Closed
zleao opened this issue Jul 14, 2020 · 3 comments
Closed

Make IsToggled change animated #71

zleao opened this issue Jul 14, 2020 · 3 comments
Labels
question Further information is requested

Comments

@zleao
Copy link

zleao commented Jul 14, 2020

Hi,
Would it be possible to have the ForceUpdateState in the IsToggledProperty with animate = true?
It would look something like this:

public static readonly BindableProperty IsToggledProperty = BindableProperty.CreateAttached(
            nameof(IsToggled),
            typeof(bool?),
            typeof(TouchEff),
            default(bool?),
            BindingMode.TwoWay,
            propertyChanged: (bindable, oldValue, newValue) =>
            {
                bindable.GetTouchEff()?.ForceUpdateState();
                TryGenerateEffect(bindable, oldValue, newValue);
            });

The reason is that this way I'm able to trigger an animation just by changing the IsToggled value...
Well, to be honest I need a bit of a 'trick' to get the animation to work... I change the state before changing the IsToggled, but the final result is exactly what I need.

So, bottom line, would it have impact if the ForceUpdateState in the IsToggled was changed to animate = true?

Thanks for this awesome library!

@AndreiMisiukevich
Copy link
Owner

No, we cannot change it cuz it will lead us to wrong behavior for IsToggled + Ripple

But I added a backdoor for you

Write it somewhere in code and you will achieve what you need.

TouchEff.IsForceUpdateStateAnimatedForIsToggledProperty = true;

@AndreiMisiukevich
Copy link
Owner

A new version will be available in 20-30 mins

@zleao
Copy link
Author

zleao commented Jul 15, 2020

Ah cool!
Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants