ListToBooleanConverter.cs 362 B

12345678910111213141516
  1. using System.Collections;
  2. namespace InABox.Avalonia.Converters;
  3. public class ListToBooleanConverter : AbstractConverter<IList, bool>
  4. {
  5. public bool EmptyValue { get; set; }
  6. protected override bool Convert(IList? value, object? parameter = null)
  7. {
  8. return value?.Count == 0
  9. ? EmptyValue
  10. : !EmptyValue;
  11. }
  12. }