문제

대규모 양의 inotifychangedproperties 이벤트로 인해 많은 UI 업데이트가있는 경우가 있습니다.이 경우 모든 속성이 일괄 적으로 설정된 경우에만 변경 사항을 UI에만 신호를 보내고 싶을 수 있습니다.

viewCollection의 새로 고침을 연기하는 방법을 설명하는 훌륭한 기사를 찾았습니다.

http://marlongrech.wordpress.com/2008/11/22 / ICollectionView - 설명 /

그러나보기가 지연 될 때 예외가 발생하고 컬렉션에 무언가를 추가하려고합니다.왜 이것이 허용되어서는 안되는 이유를 이해하지 못합니다.그것은 처음에는 그것의 모든 점입니다.

InvalidOperationException : 내용 또는 현재 위치를 변경하거나 확인할 수 없습니다. 새로 고침이 지연되는 동안 collectionview입니다.

누구도이 문제를 해결하는 방법을 알고 있습니까? 많은 감사합니다

도움이 되었습니까?

해결책

Yes, don't modify the collection in question. I think that you are misunderstanding the purpose of a collection view. This is what MSDN says;

You can think of a collection view as a layer on top of a binding source collection that allows you to navigate and display the collection based on sort, filter, and group queries, all without having to manipulate the underlying source collection itself.

So in short, don't defer the refresh until you are done adding and removing, and otherwise manipulating your collection.

다른 팁

I think you are misunderstanding or misrepresenting the MSDN help on the subject. They are saying that you don't have to modify the underlying collection to sort or filter. They are not saying that you can't modify the underlying collection. The OP has a very valid point. We have a large collection that has been sorted and filter for the user and it is displayed in a list box. When the user selects a range of those records and wants to delete them, we are forced into a situation where the ListCollectionView refreshs view for every item that was deleted.

I think the OP's question is very valid. The performance is horrendous because we have multiple filters on a huge set of data. The DeferRefresh has a real purpose on a class like the ListCollectionView, but in inexplicably diabled for inserts and deletes, when you need it the most.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top