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();
posted @ 2011-06-20 17:25  .net万剑  阅读(7835)  评论(1编辑  收藏  举报