working with groups

2 posts, 0 answers
  1. Vladimir
    Vladimir  avatar
    7 posts
    Member since:
    Dec 2012

    Posted 04 Sep 2013 Link to this post

    Hello!
    I'm working on WP7  application  with  JumpList with grouping.
    I group the records by city name, some records has empty City name, I group such items into a group "Without City".
    Also I sort  groups asc or desc dynamicly.
    And all working fine but I need that group "Without City" will be ALWAYS at the bottom of the list irrespective of the sorting
    How could I do it?

    GroupDescriptors = new List<
    GenericGroupDescriptor<Person, string>>();
      
    GenericGroupDescriptor<Person, string> group = new GenericGroupDescriptor<Person, string>();
    group.SortMode = SortMode;
    group.KeySelector = (person) =>
    {
        return person.City == "" ? person.City :"Without City";
    };
    GroupDescriptors.Add(group);
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 09 Sep 2013 Link to this post

    Hi Vladimir,

    Thanks for writing.

    You can try the following approach:

    1. Sort the persons in your source collection by City so that everyone that has no City is positioned at the bottom of the collection.

    2. Apply a group descriptor without sorting and return Without City for all items that have no city. Being at the end of the source should make that group be the last one created.

    Let me know if you need further assistance with this.

    Regards,
    Deyan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top