I've got this class:
public enum KindOfPerson
{
Student, Teacher, ...
}
public class Person
{
// This contains only numbers between 0 and 1
public double ScorePercent { get; set; }
public KindOfPerson Type { get; set; }
}
I have a people list and then I apply this LINQ function ot get another list which is classified by KindOfPerson and calculates the average score of all the people belong to that KindOfPerson:
var groupedLists = peopleList.GroupBy(person => person.Type)
.OrderBy(group => group.Key)
.Select(group => new {
People = group.ToList(),
AverageScore = group.Average(p => p.ScorePercent)
})
.ToList();
I'd like t show this list in a DataGrid but I don't have any idea to do it.
I'm trying to do this:
[DATAGRID]
Student AVERAGE SCORE: XXX
SCORE PERCENT 1
SCORE PERCENT 2
Teacher AVERAGE SCORE: YYY
SCORE PERCENT 1
SCORE PERCENT 2
Something like that, grupping by.
UPDATE
I think this code can help us: http://leeontech.wordpress.com/2010/02/01/summary-row-in-datagrid/