Browse Source

Merge pull request #2040 from ahopper/allow-animation-of-structs-without-typeConverter

allow animation of structs without typeConverter
pull/2043/head
Jumar Macato 7 years ago
committed by GitHub
parent
commit
5cb26ff9b0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Avalonia.Animation/AnimatorKeyFrame.cs

4
src/Avalonia.Animation/AnimatorKeyFrame.cs

@ -61,6 +61,10 @@ namespace Avalonia.Animation
{ {
throw new ArgumentNullException($"KeyFrame value can't be null."); throw new ArgumentNullException($"KeyFrame value can't be null.");
} }
if(Value is T typedValue)
{
return typedValue;
}
if (!typeConv.CanConvertTo(Value.GetType())) if (!typeConv.CanConvertTo(Value.GetType()))
{ {
throw new InvalidCastException($"KeyFrame value doesnt match property type."); throw new InvalidCastException($"KeyFrame value doesnt match property type.");

Loading…
Cancel
Save