A while ago I posted an article about LINQ to SQL and WPF treeviews. I demonstrated how to use multiple levels in treeviews and how to group data with LINQ. One interesting subject wasn’t covered, namely self referencing tables or the adjacency list model. A WPF TreeView control does not support this kind of data.
That is why I created a LINQ AsHierarchy() extension method to convert a flat collection to a hierachical structure of nested collections which can be assigned to the ItemsSource of a WPF Treeview.
At my personal website the whole article about the LINQ AsHierarchy() extension method can be found.

