它看起来像:
myNoResultsLabel.SetBinding(Label.IsVisibleProperty, "NameOfProperty", BindingMode.Default, new MyEmptyListIsTrueConverter());
转换器:
public class MyEmptyListIsTrueConverter: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((cast)value == value.count > 0)
{
return true
}
else
{
return false;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
documentation
和
example