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();
原文地址:https://www.cnblogs.com/midcn/p/2085389.html