DateTimeToBooleanConverter.cs 675 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Globalization;
  3. using InABox.Core;
  4. using Xamarin.Forms;
  5. namespace InABox.Mobile
  6. {
  7. public class DateTimeToBooleanConverter : BindableObject, IValueConverter
  8. {
  9. public bool EmptyResult { get; set; }
  10. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  11. {
  12. if (value is DateTime date)
  13. return date.IsEmpty() == EmptyResult;
  14. return false;
  15. }
  16. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  17. {
  18. throw new NotImplementedException();
  19. }
  20. }
  21. }