Easiest way to convert IGrouping to IHierarchicalDataSource

I have a list of business objects that I want to display in a menu. I can quickly use LINQ to created nested groups to match the desired structure but have to manually iterate through each to instantiate and populate the menu items. I'm using the DevExpress ASPxMenu which supports IHierarchicalDataSource and IHierarchicalEnumerable. What's the easiest way for me to create convert my grouped list (as IGrouping) into one of these interfaces?

Answers


I had to do something similar for a hierarchical list from a database to display in a tree control. What I ended up doing was using LINQ2XML to create XElements as necessary to model the hierarchy, and then passing the top element to the tree control.


Need Your Help

XNA 4.0 online server

sql-server web-services xna xmlhttprequest

How do I make a server for my game so you can download maps? Each map will be an XML document, but I want to have the server be in-game, instead of on a website. I do have some experience with HTML...

how do I show a string as html content in web form

c# asp.net webforms

I am trying to retrieve a html document to show in my web page, now the content comes from database as a string. Now I know there is a way to do this in win forms using Browser.DocumentText. But ho...

Qt Creator - how to set application icon for ubuntu linux?

c++ qt ubuntu qt-creator

I have seen the original question qt-creator-how-to-set-application-icon