How to create an Explorer-like folder browser control?

Thomas picture Thomas · Mar 10, 2010 · Viewed 101.2k times · Source

Using C# and WinForms in VS2008, I want to create a file browser control that looks and acts like the left pane in Windows Explorer. To my astonishment, such a control does not ship with .NET by default.

Ideally, I would like its contents to be exactly the same as in Explorer. For example, on Windows 7, it should show the Favorites and Libraries pseudo-folders. Of course, I do not want to code specifically for each version of Windows if I can help it.

I have browsed around, and there are some examples of such controls, but they are all hand-rolled and therefore won't work 100% the same as the one in Explorer.

Is there any way I can simply reuse the Explorer control instead? Or, if not, to get access to a tree of the items that it would show?

Answer

Jeff Yates picture Jeff Yates · Mar 10, 2010

Microsoft provides a walkthrough for creating a Windows Explorer style interface in C#.

There are also several examples on Code Project and other sites. Immediate examples are Explorer Tree, My Explorer, File Browser and Advanced File Explorer but there are others. Explorer Tree seems to look the best from the brief glance I took.

I used the search term windows explorer tree view C# in Google to find these links.