WaveProgressValueTextConverter.cs 589 B

1234567891011121314151617181920
  1. using System;
  2. using System.Globalization;
  3. using Avalonia.Data.Converters;
  4. namespace SukiUI.Converters.WaveProgress;
  5. public class WaveProgressValueTextConverter : IValueConverter
  6. {
  7. public static readonly WaveProgressValueTextConverter Instance = new();
  8. public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
  9. {
  10. return value is not double d ? "0%" : $"{d:#0}%";
  11. }
  12. public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
  13. {
  14. throw new NotSupportedException();
  15. }
  16. }