From 4f929ac0a14ce3ad86fcfbaf5dab2cf696c29c07 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Tue, 3 Apr 2018 19:52:35 +0800 Subject: [PATCH] Fix transitions --- src/Avalonia.Animation/Animatable.cs | 19 +++++++++++++------ src/Avalonia.Animation/Keyframes/KeyFrames.cs | 2 -- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Avalonia.Animation/Animatable.cs b/src/Avalonia.Animation/Animatable.cs index 26c35c5493..3b4f571d33 100644 --- a/src/Avalonia.Animation/Animatable.cs +++ b/src/Avalonia.Animation/Animatable.cs @@ -7,6 +7,7 @@ using System; using System.Reactive.Linq; using Avalonia.Collections; using Avalonia.Animation.Transitions; +using System.Collections.Generic; namespace Avalonia.Animation { @@ -58,17 +59,23 @@ namespace Avalonia.Animation /// /// Defines the property. /// - public static readonly StyledProperty TransitionsProperty = - AvaloniaProperty.Register(nameof(Transitions)); + public static readonly DirectProperty> TransitionsProperty = + AvaloniaProperty.RegisterDirect>( + nameof(Transitions), + o => o.Transitions, + (o, v) => o.Transitions = v); + + private IEnumerable _transitions = new AvaloniaList(); /// /// Gets or sets the property transitions for the control. /// - public Transitions.Transitions Transitions + public IEnumerable Transitions { - get { return GetValue(TransitionsProperty); } - set { SetValue(TransitionsProperty, value); } - } + get { return _transitions; } + set { SetAndRaise(TransitionsProperty, ref _transitions, value); } + } + /// /// Reacts to a change in a value in diff --git a/src/Avalonia.Animation/Keyframes/KeyFrames.cs b/src/Avalonia.Animation/Keyframes/KeyFrames.cs index b827cbbe21..a31becaccf 100644 --- a/src/Avalonia.Animation/Keyframes/KeyFrames.cs +++ b/src/Avalonia.Animation/Keyframes/KeyFrames.cs @@ -40,8 +40,6 @@ namespace Avalonia.Animation.Keyframes .Where(p=> Timing.GetGlobalPlayState() != AnimationPlayState.Paused) .Subscribe(_ => { - - var interp = DoInterpolation(animation, control) .Select(p => (object)p); control.Bind(Property, interp, BindingPriority.Animation);