Browse Source

Fixes

pull/8787/head
Steven He 4 years ago
parent
commit
5ff46b8857
  1. 11
      src/Avalonia.Base/Animation/Animation.cs
  2. 1
      src/Avalonia.Base/Avalonia.Base.csproj

11
src/Avalonia.Base/Animation/Animation.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
@ -199,10 +200,14 @@ namespace Avalonia.Animation
/// Sets the value of the Animator attached property for a setter.
/// </summary>
/// <param name="setter">The animation setter.</param>
public static void SetAnimator<TAnimator>(IAnimationSetter setter)
where TAnimator : IAnimator, new()
/// <param name="value">The property animator value.</param>
public static void SetAnimator(IAnimationSetter setter,
#if NET6_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.PublicMethods)]
#endif
Type value)
{
s_animators[setter] = (typeof(TAnimator), () => new TAnimator());
s_animators[setter] = (value, () => (IAnimator)Activator.CreateInstance(value)!);
}
private readonly static List<(Func<AvaloniaProperty, bool> Condition, Type Animator, Func<IAnimator> Factory)> Animators = new()

1
src/Avalonia.Base/Avalonia.Base.csproj

@ -6,6 +6,7 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Assets\*.trie" />

Loading…
Cancel
Save