IntLessThanConverter.cs 586 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Globalization;
  3. using Avalonia.Data.Converters;
  4. namespace Dock.Avalonia.Converters;
  5. internal class IntLessThanConverter : IValueConverter
  6. {
  7. public int TrueIfLessThan { get; set; }
  8. public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
  9. {
  10. if (value is int intValue)
  11. {
  12. return intValue < TrueIfLessThan;
  13. }
  14. return false;
  15. }
  16. public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
  17. {
  18. return null;
  19. }
  20. }