我有一个 https://drive.google.com/uc?authuser=0&id=[your ID without brackets]&export=download
绑定到listview
的{{1}}上,并且效果很好:
Dictionary
我现在需要将Observable Collections
绑定到同一源,并且如果列表为空但不知道格式,请使用var Key = "something";
myListView.SetBinding(ListView.ItemsSourceProperty, $"Items[{Key}]");
来显示可见性
Label
谢谢
答案 0 :(得分:1)
它看起来像:
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();
}
}
有关IValueConverter的更多信息,位于documentation和example