CollectionView without a dispatcher

2019-09-13 19:58发布

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?

2条回答
相关推荐>>
2楼-- · 2019-09-13 20:13

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.

查看更多
做个烂人
3楼-- · 2019-09-13 20:25

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.

查看更多
登录 后发表回答