What's the easiest way to sort an EF4 EntityCollection<T>?

Posted by Will on Stack Overflow See other posts from Stack Overflow or by Will
Published on 2010-05-16T20:45:51Z Indexed on 2010/05/16 20:50 UTC
Read the original article Hit count: 443

I'd love to add some sorting to an EntityCollection that is bound to an ItemsControl (in xaml). I'd also like to do it as simply as possible. It appears that this is not possible.

If I wrap the collection in a "sorted" version of the collection property within the Entity I lose collection change notifications. I can't use a CollectionViewSource because the entity collection's BindingListCollectionView does not support sorting for some goddamned reason (note: I've seen the blog post with the "dirty" hack to get around this, so please don't answer with that kthx).

Is there a simple (couple lines of xaml, couple lines of code, whatever) way to achieve this??

© Stack Overflow or respective owner

Related posts about ef4

Related posts about entitycollection