I'd like to create a visibility converter which displays content if an observablecollection is empty or null. As this converter will be used on many screens, each collection will hold a different type (T).
How do I get a reference to the ObservableCollection of unknown type. This is what I have so far:
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null) return Visibility.Visible;
if (value is ObservableCollection<object>)
{
var col = value as ObservableCollection<object>;
return col.Count > 0 ? Visibility.Hidden : Visibility.Visible;
}
return Binding.DoNothing;
}