2013-11-27 3 views
0

MoveCurrentTo 메서드를 사용하여 CollectionView에서 현재 항목을 설정하려고하지만 결과로 collectionView : s 현재 항목이 null로 설정됩니다.CollectionView.MoveCurrentTo 현재 항목을 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); 

답변

0

customers.Values에 의해 노출 된 컬렉션은 아마도 INotifyCollectionChanged를 지원하지 않습니다. ObservableDictionary 구현을 사용하면 문제가 해결 될 가능성이 높습니다.