views:

676

answers:

2

Does anyone known (or even has an example) of a WPF based TreeListView that can generate its colums by databinding to the ObservableCollection of its tree items?

For example the databound model is a tree consisting of Employee instances representing the supervisor hierarchy of a company. Each employee addtionally has a ObservableCollection of Responsibility instances (Properties: ResponsibiltyName, ResponsibleSinceDate). Now I want a separate column for each ResponsibiltyName found in any of the databound Employees and the column value should be populated with the ResponsibleSinceDate. If an Employee does not have a certain Responsibilty the column value shall be left blank.

How would one usually approach such a problem in WPF?

+1  A: 

You may want to take a look at the following answer: http://stackoverflow.com/questions/320089/how-do-i-bind-a-wpf-datagrid-to-a-variable-number-of-columns

Here a solution involving a CompositeCollection is suggested: http://social.msdn.microsoft.com/forums/en-US/wpf/thread/a4c5b2de-260c-49d0-b4ff-cca6ee4e8b08/

Here a solution involving a HierarchicalDataTemplate is suggested: http://blogs.msdn.com/karstenj/archive/2005/11/02/488420.aspx

Hope this helps!

murki
+1  A: 

You can't do it. Sorry.

Daniel Jennings