问题
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