How I Can Refresh ListView in WPF

后端 未结 5 452
死守一世寂寞
死守一世寂寞 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:21

    If you still need to refresh your ListView in any other case (lets assume that you need to update it ONE time after ALL the elements were added to the ItemsSource) so you should use this approach:

    ICollectionView view = CollectionViewSource.GetDefaultView(ItemsSource);
    view.Refresh();
    

提交回复
热议问题