I have ItemsC开发者_Go百科ontrol in a WPF application, which is bind to an array of objects. And I am using ItemTemplate to render the list. I want to display for each item in the list the item order, like for example
Customer 1 Name : xxxxx Age: 9999
Customer 2 Name : yyyy Age: 8888
Any idea how to do it Thanks
I think what you are asking is how to sort your ItemsSource property when displaying it in an items control?
You can do this by using a CollectionViewSource. The CollectionViewSource gives you the ability group and / or sort your ItemsSource. It does this by creating a "view" which is a separate copy of your items source with your grouping and sorting applied to it.
This allows you to show your data in multiple different groupings or sortings on the same page while still only having one underlying source collection.
精彩评论