Browse Source

Animatable: subscribe to collection changes only if transitions are already enabled. (#12861)

Co-authored-by: Dmitry Zhelnin <d.zhelnin@of-group.ru>
pull/12941/head
DmitryZhelnin 3 years ago
committed by GitHub
parent
commit
9eeb3ee340
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/Avalonia.Base/Animation/Animatable.cs

10
src/Avalonia.Base/Animation/Animatable.cs

@ -123,8 +123,14 @@ namespace Avalonia.Animation
toAdd = newTransitions.Except(oldTransitions).ToList();
}
newTransitions.CollectionChanged += TransitionsCollectionChangedHandler;
_isSubscribedToTransitionsCollection = true;
// Subscribe to collection changes only if transitions are already enabled,
// i.e. control is attached to the visual tree
if (_transitionsEnabled)
{
newTransitions.CollectionChanged += TransitionsCollectionChangedHandler;
_isSubscribedToTransitionsCollection = true;
}
AddTransitions(toAdd);
}

Loading…
Cancel
Save