您看过分组和语义缩放示例吗?http://code.msdn.microsoft.com/windowsapps/groupedgridview-77c59e8e
您还可以查看如何在列表或网格中对项目进行分组...
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh780627.aspx
简短的解释是......你可以用两种方法之一来做......
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" });
接下来是获取 CollectionViewSource 中的数据
var result = from act in Activities
group act by act.Project into grp
orderby grp.Key select grp;
cvsActivities.Source = result;
或者您可以使用这样的对象属性构建层次结构......
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;
您无法绑定到简单列表并自动为您配置分组。