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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
2 deletions
-
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); |
|
|
|
} |
|
|
|
|
|
|
|
|