Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8500811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:02:21+00:00 2026-06-11T01:02:21+00:00

How should I make my collection for grouped collection in gridview ? When I

  • 0

How should I make my collection for grouped collection in gridview ?

When I create List<List<MyObject>> groups I get grouped data with good count of groups and elements in each group but I have no group titles.
So I’ve created object MyGroupedObject that has two fields

public String Key;
public List<MyObject> items;

so I have grouped that in object. But when I pass it to the grid view (like below) I have nothing. No items, no groups no nothing

 <Page.Resources>
<!--
    Collection of grouped items displayed by this page, bound to a subset
    of the complete item list because items in groups cannot be virtualized
-->
<CollectionViewSource
    x:Name="groupedItemsViewSource"
    IsSourceGrouped="true"
    />

</Page.Resources>

than in gridview i just bind this collection as ItemsSource

this question is based on: how to create gridview from dictionary

I’ve created new cause in the original is to many questions so I want to make it all clear

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:02:22+00:00Added an answer on June 11, 2026 at 1:02 am

    Have you looked at the Grouping and Semantic Zoom sample? http://code.msdn.microsoft.com/windowsapps/groupedgridview-77c59e8e

    You can also look at How to group items in a list or grid…
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh780627.aspx

    Short explanation is… you can do it one of two ways…

    List<Activity> Activities = new List<Activity>(); 
    Activities.Add(new Activity() 
        { Name = "Activity 1", Complete = true, 
                DueDate = startDate.AddDays(4), Project = "Project 1" });
    Activities.Add(new Activity() 
        { Name = "Activity 2", Complete = true, 
                DueDate = startDate.AddDays(5), Project = "Project 2" });
    

    followed by the following to get the data in your CollectionViewSource

    var result = from act in Activities 
                 group act by act.Project into grp 
                 orderby grp.Key select grp;
    cvsActivities.Source = result;
    

    Or you can build a hierarchy using object properties like this…

    List<Project> Projects = new List<Project>();
    
    Project newProject = new Project();
    newProject.Name = "Project 1";
    newProject.Activities.Add(new Activity() 
        { Name = "Activity 1", Complete = true, DueDate = startDate.AddDays(4) });
    newProject.Activities.Add(new Activity() 
        { Name = "Activity 2", Complete = true, DueDate = startDate.AddDays(5) });
    newProject.Activities.Add(new Activity() 
        { Name = "Activity 3", Complete = false, DueDate = startDate.AddDays(7) });
    newProject = new Project();
    newProject.Name = "Project 2";
    newProject.Activities.Add(new Activity() 
        { Name = "Activity A", Complete = true, DueDate = startDate.AddDays(2) });
    newProject.Activities.Add(new Activity() 
        { Name = "Activity B", Complete = false, DueDate = startDate.AddDays(3) });
    cvsProjects.Source = Projects;
    

    You cannot bind to a simple list and have the grouping automatically configured for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a collection that stores groups of users. A user can
If an object has a property that is a collection, should the object create
I'm a bit confused whether or not I should make the links on my
So I have a huge program and decided I should make one of the
In java they say don't concatenate Strings, instead you should make a stringbuffer and
how big (binary(xy)) should I make my table column in SQL database if I
I have a sandboxed Applet, but that should not make a difference. The Applet
In my program the receiver has a bigger workload, should i make the sender
What should I do to make my MVC application to be updtable? Saying 'updatable'
What technique should we use to make the httpsession object not loaded heavily with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.