CollectionToVisibility.cs 596 B

1234567891011121314151617181920212223242526272829
  1. 
  2. namespace HistoryView.Converters;
  3. public class CollectionToVisibility : IValueConverter
  4. {
  5. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  6. {
  7. dynamic d = value;
  8. try
  9. {
  10. if (d.Count == 0)
  11. {
  12. return Visibility.Collapsed;
  13. }
  14. }
  15. catch
  16. {
  17. }
  18. return Visibility.Visible;
  19. }
  20. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  21. {
  22. throw new NotImplementedException();
  23. }
  24. }