I have a need to customize a Datagrid, for a TimeManagement system, using rowspawns. My desired look is something like:
Customers| Projects | Tasks | Moanday | Tuesday | Wednesday | Thursday | Friday | | | Task 1 | 0 | 0 | 0 | 0 | 0 | Customer1| Project 1 | Task 2 | 0 | 0 | 0 | 0 | 0 | | | Task 3 | 0 | 0 | 0 | 0 | 0 |
Preferebly, i would like to be able to just give the DataGrid.ItemSource a List of Customers and it should work based on that. My current Model is
public class Customer { public string Name{get; set;} public List<Project> Projects{ get; set;} } public class Project { public string Name {get; set;} public List<Task> Tasks{ get; set; } } public class Task { public string Name { get; set;} public Week Week { get; set; } } public class Week { public double Monday { get; set; } ... }
- I would like the Customer Cell to have a rowspan over all of its project rows.
- I would like the Project cell to have a rowspan over all of its task rows.
- And, most importantly, i need the user to be able to navigate around using the arrowkeys on the keyboard.
My first attempt was to create new datagrids inside cells of another datagrid. It seems a user is not able to navigate from one datagrid to another using the arrowkeys.
Any help is much appreciated.
Take a look at the ‘RowDetailsTemplate’ in the DataGrid. It’s a section that can be expanded beneath a row. Inside the RowDetailsTemplate you can add whatever you need, such as a grid or even a datagrid. Set the RowDetailsVisibilityMode attribute to Visible, and it will always be shown.
Good luck.
–Matt