Uno: We cannot change the value of a DependencyProperty which has been animated

Created on 27 Feb 2019  路  2Comments  路  Source: unoplatform/uno

I'm submitting a...

  • Bug report (I searched for similar issues and did not find one)

Current behavior

Once an animation has been used to alter a DependencyProperty, we cannot change its value using the property accessor.

Expected behavior

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.

Minimal reproduction of the problem with instructions

  1. Alter a property using an animation
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();
  1. Alter the property using SetValue:
_transform.Y = 0; // This won't have any effect
Assert.IsTrue(_transform.Y == 50); // This will pass 馃槺

Workaround

You cant alter the value using another animation.

Environment

Nuget Package: Uno.UI
Package Version(s): _irrelevant_
Affected platform(s):

  • [x] iOS
  • [x] Android
  • [x] WebAssembly
  • [ ] Windows
  • [ ] Build tasks

Visual Studio: _irrelevant_
Relevant plugins: _none_

kinbug platforandroid platforios platforwasm projecanimations

All 2 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MartinZikmund picture MartinZikmund  路  3Comments

MartinZikmund picture MartinZikmund  路  3Comments

chrisevans9629 picture chrisevans9629  路  4Comments

JanabiSoft picture JanabiSoft  路  4Comments

MartinZikmund picture MartinZikmund  路  4Comments