I have a “structure” question about my project. Assuming i want this as a result
http://msdn.microsoft.com/de-de/library/vstudio/ff407126.aspx , a DataGrid with “Projects” and every Project has several Tasks.
I already have a MainWindowViewModel + MainWindowView which displays the DataGrid with the Header-Lines.
For every Project I have a Project object which contains several Task-Objects.
How can i now split up the DataGrid into several ViewModels / Views?
The Problem is, later i will have different kind of tasks and the layout of the grid will slightly differ only for this task. (e.g. no Progressbar or different colors/text-bindings
Will I need a SchedulerViewModel(+View) and a ProjectViewModel(+view) for every Project and a TaskViewModel(+View) for every Task?
You’ll want to use templating. The DataGrid’s ItemsSource property should point to your collection of Project objects. Then you’ll want to assign a template to the DataGrid’s ItemTemplate property, describing the appearance of a “Project” object. Most likely the template for a “Project” row will be an ItemContainer of some sort; this ItemContainer will in turn have it’s own ItemsSource property set to the project’s collection of Tasks, which in turn will have it’s own item template through which you can describe the appearance of Tasks.