开发者

What is a good way to get a ordered collection from a view model for bindings with MVVM Light?

I have a view model that currently exposes an ObservableCollection. With my WP7 app, I need to show a secondary screen that basically lets you sort what comes out of the collection, and you to the results again.

I started adding a ApplyOrder method on the view model to address this, but quickly realized I was not sure what direction to take, as when you add the orderby, you wind up with an IOrderedEnumerable.

What is the best way to get those results ordered?

开发者_开发百科

Thanks, Roger


CollectionViewSource is your friend.

Assign its Source property to your ObservableCollection and Add one or more SortDescriptions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜