WPF (当 ItemsSource 正在使用时操作无效。改用 ItemsControl.ItemsSource 访问和修改)错误解决方案

  
    
int selectIndex = dgExport.SelectedIndex;
ICollectionView view
= (ICollectionView)CollectionViewSource.GetDefaultView(dgExport.ItemsSource);
List
< Export > items = new List < Export > ();
items
= (List < Export > )view.SourceCollection;
items.RemoveAt(selectIndex);
dgExport.Items.Refresh();

你可能感兴趣的:(source)