CollectionView without a dispatcher

懵懂的女人 提交于 2019-12-25 11:52:28

问题


I need a sorting, grouping and filtering behavior of a CollectionView also with LiveShaping properties, but every .NET implementation has a Dispatcher connected to it.

Is there any implementation of the ICollectionView without a dispatcher?


回答1:


Is there any implementation of the ICollectionView without a dispatcher?

No, there isn't. The only class that implements this interface in the .NET Framework is the CollectionView class and it is a DispatcherObject.

So you will have to provide your own implementation or solve your issue in a different way.




回答2:


From MSDN:

Remarks:

The interface is implemented by the CollectionView class, which is the base class for BindingListCollectionView, ListCollectionView, and ItemCollection.

CollectionView derives from System.Windows.Threading.DispatcherObject, so this class and all derived will always have Dispatcher property, because Dispatcher property is not virtual, abstract or override, other way you could mark it as sealed and use a derived class without Dispatcher property.

Other remark for CollectionView:

Remarks:

You should not create objects of this class in your code. To create a collection view for a collection that only implements IEnumerable, create a CollectionViewSource object, add your collection to the Source property, and get the collection view from the View property.

It is not a solution of your problem, but an answer on your question.



来源:https://stackoverflow.com/questions/43340949/collectionview-without-a-dispatcher

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!