How to: Create a Windows Explorer–Style Interface on a Windows Form

Windows Explorer is a common user-interface choice for applications because of its ready familiarity.

Windows Explorer is, essentially, a TreeView control and a ListView control on separate panels. The panels are made resizable by a splitter. This arrangement of controls is very effective for displaying and browsing information.

The following steps show how to arrange controls in a Windows Explorer-like form. They do not show how to add the file-browsing functionality of the Windows Explorer application.

To create a Windows Explorer-style Windows Form

  1. Create a new Windows Application project (File > New > Project > Visual C# or Visual Basic > Classic Desktop > Windows Forms Application).

  2. From the Toolbox:

    1. Drag a SplitContainer control onto your form.

    2. Drag a TreeView control into SplitterPanel1 (the panel of the SplitContainer control marked Panel1).

    3. Drag a ListView control into SplitterPanel2 (the panel of the SplitContainer control marked Panel2).

  3. Select all three controls by pressing the CTRL key and clicking them in turn. When you select the SplitContainer control, click the splitter bar, rather than the panels.

    Note

    Do not use the Select All command on the Edit menu. If you do so, the property needed in the next step will not appear in the Properties window.

  4. In the Properties window, set the Dock property to Fill.

  5. Press F5 to run the application.

    The form displays a two-part user interface, similar to that of the Windows Explorer.

    Note

    When you drag the splitter, the panels resize themselves.

See also