Embedding a File Explorer instance in a WinForms app form

Posted by Unsliced on Stack Overflow See other posts from Stack Overflow or by Unsliced
Published on 2009-02-12T17:16:40Z Indexed on 2010/04/14 9:13 UTC
Read the original article Hit count: 509

Filed under:
|
|

My (C#, .NET 3.5) app generates files and, in addition to raising events that can be caught and reacted to, I want to display the target folder to the user in a form. The file-list is being shown within the same form as other information.

I'm using an instance of the WebBrowser control (System.Windows.Forms.WebBrowser), then navigating to the folder. This shows some default view of the explorer window, with the file summary panel on the left and the files in the 'Tiles' (large icon and text) view.

e.g.

wb.Navigate(@"c:\path\to\folder\");

I'd like to suppress the panel and to view the file list in the Details view. The user can get to this via a right-click, context menu, but I'd like it to come up automatically.

I'd rather not have to build my own TreeView, DataGridView or whatever; the WebBrowser control does all the updating and re-sorting and whatnot 'for free'.

Does anybody have a better suggestion? A different control to use or some additional arguments to pass to the control?

And if I could trap events (e.g. files being selected/renamed/double-clicked, etc.) then all the better!

© Stack Overflow or respective owner

Related posts about winforms

Related posts about c#