Click here to Skip to main content
14,691,000 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
For Example

Student
{
 Name
 List<Subject>
}

Subject
{
 GroupName
 SubjectName
 Grade
}


DataGrid/ListView be like
Subject              Student1    Student2    Student3 ..... Student n
---------------------------------------------------------------
Languages (GroupName)
  English              A            A+         -NA-
  French               -NA-         A           A+
  German                A+         -NA-         A
Mains (GroupName)
  Maths                 B            A          A
  Physics               A            A          -NA-
  Chemistry             A            B          -NA-
  Economics             -NA-        -NA-         A
  Commerce              -NA-        -NA-         A


No. of students is not fix
No. subjects is not fix
No. Groups is not fix

I need to bind List<students> to DataGrid/ListView

What I have tried:

I tried ListView with CollectionViewSource and GroupStyle but i am able to display only one student record.
Posted
Updated 11-Mar-20 23:55pm
v4

1 solution

   
Comments
Maciej Los 12-Mar-20 4:57am
   
MSDN documentation is always good for start.
chimmansrikanth 12-Mar-20 5:09am
   
Yes, but I could not relate anything related to my problem. Thank you
Maciej Los 12-Mar-20 5:15am
   
WPF is using MVVM pattern. So, you have to create model, view and viewmodel which corresponds to your design.
Richard MacCutchan 12-Mar-20 5:19am
   
What problem? You have not given us any information.
chimmansrikanth 12-Mar-20 5:26am
   
I want to show the List<student> in DataGrid or ListView as specified in the question, which I am not able to do. I tried ListView with CollectionViewSource and GroupStyle but i am able to display only one student record.
Richard MacCutchan 12-Mar-20 5:37am
   
:sigh: We know what you want to do. But we have no idea what code you are using or where the error occurs.
chimmansrikanth 12-Mar-20 12:09pm
   
I need code to bind the List<student> to datagrid, and output should be the one i have shown in the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900