【发布时间】:2013-11-27 13:50:16
【问题描述】:
我正在尝试使用 MoveCurrentTo 方法在 CollectionView 中设置当前项,但结果是 collectionView:s 当前项设置为 null。
我的 collectionViewSource.source 是一本字典。我想要做的是将一个新项目添加到我的集合中,然后将视图中的当前项目设置为新项目,但我无法让它工作。
谁能解释为什么这不起作用?
Customers customers = null;
customers = new Customers();
customers.Fill();
CustomerCollectionView = new CollectionViewSource();
CustomerCollectionView.Source = customers.Values;
Customer customerItem = new Customer();
customers.Add(customerItem);
CustomerCollectionView.View.MoveCurrentTo(customerItem);
【问题讨论】:
标签: c# collectionview