Answered by:
GridView Sorting

Question
-
What is a best way to allow a user to resort a Gridview from a click event.
My initial sort is set as follows in XAML using the ItemsPath
<CollectionViewSource x:Name="groupedItemsViewSource" Source="{Binding Groups}" IsSourceGrouped="true" ItemsPath="SortedTopItems"
public IOrderedEnumerable<PictureViewModel> SortedTopItems { get { return TopItems.OrderByDescending(p => p.StartDate).Take(3).OrderByDescending(p => p.StartDate); } }
Can I change the ItemPath if so how or maybe there is a better way? I was hoping 8.1 added new methods for sorting a GridView / ListView on higher level?
Thank you
- Edited by Andy Sid Sunday, January 12, 2014 6:42 PM
Sunday, January 12, 2014 3:23 AM
Answers
-
First, let me say that posting over the weekend, then bumping the post before business hours will automatically result in a lower viewcount for your post.
Sorting the list should be as simple as reordering the underlying list, then rebinding the collectionvieesource to the list.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.- Proposed as answer by Jamles HezModerator Thursday, January 23, 2014 2:53 AM
- Marked as answer by Matt SmallMicrosoft employee, Moderator Thursday, January 23, 2014 6:57 PM
Wednesday, January 22, 2014 1:55 PMModerator
All replies
-
Can someone help with this please?Monday, January 13, 2014 3:45 AM
-
First, let me say that posting over the weekend, then bumping the post before business hours will automatically result in a lower viewcount for your post.
Sorting the list should be as simple as reordering the underlying list, then rebinding the collectionvieesource to the list.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.- Proposed as answer by Jamles HezModerator Thursday, January 23, 2014 2:53 AM
- Marked as answer by Matt SmallMicrosoft employee, Moderator Thursday, January 23, 2014 6:57 PM
Wednesday, January 22, 2014 1:55 PMModerator -
Thanks Matt. I must remember also I am on New Zealand time so a bit out of sync work hours to others.
Thursday, January 23, 2014 7:04 PM