Browse Source

Fix using pattern matching

pull/4165/head
Rustam Sayfutdinov 6 years ago
parent
commit
be4f4ed1c2
  1. 9
      src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs

9
src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs

@ -51,17 +51,14 @@ namespace Avalonia.Animation.Animators
if (_colorAnimator == null) if (_colorAnimator == null)
InitializeColorAnimator(); InitializeColorAnimator();
SolidColorBrush finalTarget;
// If it's ISCB, change it back to SCB. // If it's ISCB, change it back to SCB.
if (targetVal.GetType() == typeof(ImmutableSolidColorBrush)) if (targetVal is ImmutableSolidColorBrush immutableSolidColorBrush)
{ {
var col = (ImmutableSolidColorBrush)targetVal; targetVal = new SolidColorBrush(immutableSolidColorBrush.Color);
targetVal = new SolidColorBrush(col.Color);
control.SetValue(Property, targetVal); control.SetValue(Property, targetVal);
} }
finalTarget = targetVal as SolidColorBrush; var finalTarget = targetVal as SolidColorBrush;
return _colorAnimator.Apply(animation, finalTarget, clock ?? control.Clock, match, onComplete); return _colorAnimator.Apply(animation, finalTarget, clock ?? control.Clock, match, onComplete);
} }

Loading…
Cancel
Save