How I Can Refresh ListView in WPF

后端 未结 5 455
死守一世寂寞
死守一世寂寞 2020-12-05 17:37

Hi I am using WPF and adding records one by one to the listview.ItemsSource. My data will appear when all the data is included, but I want to show the data as it is added o

5条回答
  •  鱼传尺愫
    2020-12-05 18:41

    @decyclone:

    I'm working in WPF the idea is to have a tree view that we can dynamically add and remove elements - files. The ObservableCollection was the method for adding (using drag and drop and an open dialog box for files)

    ObservableCollection worked fine for adding but items removal was not being displayed correctly. The refresh method did not "refresh". The solution was to reset (again) the listview.ItemSource to the new values (the list without the elements that were removed).

提交回复
热议问题