我正在動態改寫它的XML itemSource,並希望它立即使用新數據...你如何強制WPF ListView的Requery它的ItemSource?
4
A
回答
4
您應該使用ObervableCollection。當這個集合被更新時,ListView被更新。
但如果你鴕鳥政策任何理由要使用一個,使用:
listView.InvalidateProperty(ListView.ItemsSourceProperty);
或
listView.ItemsSource = listView.ItemsSource;
檢查A more elegant ListView requery獲取更多信息。
-1
1
嗯......
listView.ItemsSource = listView.ItemsSource?
,或者你可以觸發你的視圖模型中使用的是MVVM情況下屬性的PropertyChanged事件。
相關問題
- 1. WPF ListView綁定到ItemSource?
- 2. 如何更改WPF ListView SelectedItem字體顏色與ItemSource綁定?
- 3. Wpf強制MenuItem創建它的子項
- 4. WPF Datagrid ItemSource + ObservableCollection
- 5. 如何強制ListView手動重新使用它的.Items.Filter視圖?
- 6. 你如何強制listPreference重置它的值?
- 7. WPF - 如何強制命令
- 8. 你如何強制Eclipse的OS標誌?
- 9. WPF的ItemSource返回null
- 10. WPF控制的ListView
- 11. 設置的ListView的ItemSource代碼
- 12. Binding itemSource ListView in Mode = TwoWay
- 13. 你如何強制quicktime全屏鍍鉻
- 14. 如何強制圖像控制關閉它在wpf中打開的文件
- 15. 如何強制listview刷新其視圖?
- 16. 強制onSizeChanged爲ListView
- 17. ListView強制關閉
- 18. WPF的Datagrid:強制刷新
- 19. 如何使用XPath設置ListView控件的ItemSource
- 20. 如何強制關閉ContextMenu(WPF項目)?
- 21. WPF。如何強制listitem重繪自己?
- 22. WPF DataGrid的DataGridTemplateColumn組合框ItemSource
- 23. 你可以強制Clojure宏來評估它的參數嗎?
- 24. 如何正確列表使用的ItemSource綁定到WPF DataGrid中
- 25. 如何添加WPF DataGridTemplateColumn.CellEditingTemplate組合框的ItemSource在後端
- 26. 如何在wpf中使用大量的ItemSource處理ListBox?
- 27. 如何區分WPF ItemSource中的ID和顯示值?
- 28. 強制關閉的ListView在Android的
- 29. Xamarin.iOS UITableView,你如何強制一個單元更新?
- 30. 如何強制更新來自Adapter的ListView中的數據?
我試過這個,但它沒有做任何事情.. this.lvwSourceFiles.GetBindingExpression(ListView.ItemsSourceProperty).UpdateSource(); – KevinDeus 2009-07-10 22:05:55