EasingTypeConverter.cs 719 B

123456789101112131415161718192021222324
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using Avalonia.Animation.Easings;
  4. using System;
  5. using System.ComponentModel;
  6. using System.Globalization;
  7. namespace Avalonia.Animation.Easings
  8. {
  9. public class EasingTypeConverter : TypeConverter
  10. {
  11. public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
  12. {
  13. return sourceType == typeof(string);
  14. }
  15. public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
  16. {
  17. return Easing.Parse((string)value);
  18. }
  19. }
  20. }