Once an animation has been used to alter a DependencyProperty, we cannot change its value using the property accessor.
During the animation, the SetValue(DP, value) has no effect (but the value is stored for future animations), and once the animation is completed, we can change the value using SetValue(DP, value), and future animations use this new value as initial value.
var animation = new DoubleAnimation
{
To = 50,
Duration = new Duration(TimeSpan.FromSeconds(10))
};
Storyboard.SetTargetProperty(animation, nameof(TranslateTransform.Y));
Storyboard.SetTarget(animation, _transform);
new Storyboard
{
Children = { animation}
}.Begin();
SetValue:_transform.Y = 0; // This won't have any effect
Assert.IsTrue(_transform.Y == 50); // This will pass 馃槺
You cant alter the value using another animation.
Nuget Package: Uno.UI
Package Version(s): _irrelevant_
Affected platform(s):
Visual Studio: _irrelevant_
Relevant plugins: _none_
I have the same problem.
This is my workaround:
_transform.Y = y; // Just this doesn't work.
#if __IOS__ || __ANDROID__
_transform.SetValue(TranslateTransform.YProperty, y, DependencyPropertyValuePrecedences.Animations);
#endif
@dr1rrb