When you open a folder in Windows and the contents are displayed what type of control are the contents displayed in.

ie Open folder C:/data/WorkFiles

You get the list of files eg .txt, .docx, .pdf, .xml

Is it possible to catch this and dock it in a container.

Hope this is not too difficult a question.

Malcolm

Dani AI

Generated

Short answer and an approach you can use today.

The folder pane you see in Explorer is implemented by the Windows Shell as a shell "view" (COM-based) that renders on top of the native list‑view control. There is no single managed WinForms control shipped that exactly matches Explorer's behavior, so you either (A) host the Shell view via Shell COM interfaces, or (B) recreate the view in your app and populate a WinForms control yourself. This follows what suggested and picks up where that answer left off.

Practical choices and tradeoffs:

  • Recreate (recommended for most apps): use a WinForms control (ListView or DataGridView) in virtual mode for large folders, enumerate files with .NET IO, and fetch icons and shell metadata via the Shell API (for example, SHGetFileInfo or the shell image list and the property system). Virtual mode + on-demand icon/thumbnail loading keeps performance good. Implement context menus, drag/drop and sorting by calling the appropriate shell APIs only where needed.
  • Host the real Explorer view: use the Shell COM hosting interfaces (IExplorerBrowser / IShellView or the older SHCreateShellFolderView paths). This yields an identical experience but requires COM interop, careful lifetime management, and testing across Windows versions. It is heavier and more fragile than recreating the UI.

Concrete next steps:

  1. Decide if you need exact Explorer behavior or just a file list with icons, types and dates.
  2. If you recreate: implement a virtual ListView, populate names via Directory.EnumerateFiles, call SHGetFileInfo for icons/type strings, and use the shell property API for extra columns.
  3. If you must embed Explorer, look into IExplorerBrowser or a maintained wrapper (Windows API Code Pack variants) and test thoroughly on target OS versions.

Note: GridView in ASP.NET is a web control and unrelated to desktop list controls; choose a desktop control (ListView/DataGridView) when targeting WinForms.

Recommended Answers

All 3 Replies

Do you mean an OpenFileDialog?

I think it's akin to a ListView, but there is no automatic "explorer" control you can use out of the box.

Yes I am aware of OpenFileDialog. What I need to know and I think Ketsuekiame has given me the answer. I have researched this control (ListView)now. What was putting me in doubt was that in ASP.Net examples they seem to use the gridview mostly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.