locked
XAML/C# Data Sorting With Dynamic Variables

    Question

  • I apologize if this issue has been discussed elsewhere or if it is inherently easy to understand for others. I am new to this development platform.

    I will try to be as descriptive as possible in order to help you help me. 

    I am a student developing my first Windows App that showcases newly released books. The data is being displayed in a GridView and is being retrieved from a .json file only slightly modified from the MSDN tutorial on Grid View data sourcing. I have included this .json, its related .cs, and the 3 .cs/.xaml grid view pages all related to my question here. It may be useful to note that the .json data file contains mostly default data. I have only added a few book entries for testing purposes until I get this end to work properly. 

    Firstly, I'm not sure if I should even be utilizing GridView to achieve this, but it's worked out well so far and I'm hoping I can continue this way. This is what I am trying to accomplish: 

    While looking at the GroupItemsPage screenshot:

    I am using the different sections of the upper-most grid view page (GroupItemsPage) to sort the books by various categories. I want the user to be able to click on a section title and be taken to a list of books being sorted by that section. I.E., by book title, by author name, by genre, etc. 

    While looking at GroupDetailPage screenshot:

    This is the list that I want to alphabetize descending by book title/author/genre/etc. Even though each different group of this grid is physically located on the same page (GroupDetailPage), I will need to sort the data using different variables depending on which section the user has selected. 

    I only need to sort it descending alphabetically, I believe the hard part will be sorting the data using different variables depending on which section the user has selected. If the user clicks on "By Title" on the main page, they should be brought to a list of books sorted by title. Etc, etc. 


    Can anyone help point me in the right direction on how I can accomplish this kind of sorting? 


    I took a look at the MSDN guide on data sorting here:


    http://msdn.microsoft.com/en-us/library/ms742542%28v=vs.110%29.aspx


    but I'm not sure how this would be applicable in my situation where the variable I am sorting by changes based on user interaction. 



    I sincerely appreciate your time for reading this far and helping me in any way you can. 


    Thanks,

    Jonathan


    Tuesday, April 08, 2014 5:10 PM

Answers