LINQ AsHierarchy() extension method

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.


Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: