我正在重写它的 XML itemSource 并希望它立即使用新数据...
最佳答案
您应该使用 ObervableCollection。当此集合更新时,ListView 也会更新。
但是如果出于任何原因你不想使用它,请使用:
listView.InvalidateProperty(ListView.ItemsSourceProperty);
或
listView.ItemsSource = listView.ItemsSource;
检查 A more elegant ListView requery了解更多信息。
关于c# - 如何强制 WPF ListView 重新查询它的 ItemSsource?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1111338/