ListView Control Overview (Windows Forms)

The Windows Forms ListView control displays a list of items with icons. You can use a list view to create a user interface like the right pane of Windows Explorer. The control has four view modes: LargeIcon, SmallIcon, List, and Details.

What You Can Do with the ListView Control

Note

An additional view mode, Tile, is only available on Windows XP and the Windows Server 2003 operating system. For more information, see How to: Enable Tile View in a Windows Forms ListView Control.

The LargeIcon mode displays large icons next to the item text; the items appear in multiple columns if the control is large enough. The SmallIcon mode is the same except that it displays small icons. The List mode displays small icons but is always in a single column. The Details mode displays items in multiple columns. For details, see How to: Add Columns to the Windows Forms ListView Control. The view mode is determined by the View property. All of the view modes can display images from image lists. For details, see How to: Display Icons for the Windows Forms ListView Control.

The following table lists some of the ListView members and the views they are valid in.

ListView member View
Alignment property SmallIcon or LargeIcon
AutoArrange property SmallIcon or LargeIcon
AutoResizeColumn method Details
Columns property Details or Tile
DrawSubItem event Details
FindItemWithText method Details, List, or Tile
FindNearestItem method SmallIcon or LargeIcon
GetItemAt method Details or Tile
Groups property All views except List
HeaderStyle property Details.
InsertionMark property LargeIcon, SmallIcon, or Tile

The key property of the ListView control is Items, which contains the items displayed by the control. The SelectedItems property contains a collection of the items currently selected in the control. The user can select multiple items, for example to drag and drop several items at a time to another control, if the MultiSelect property is set to true. The ListView control can display check boxes next to the items, if the CheckBoxes property is set to true.

The Activation property determines what type of action the user must take to activate an item in the list: the options are Standard, OneClick, and TwoClick. OneClick activation requires a single click to activate the item. TwoClick activation requires the user to double-click to activate the item; a single click changes the color of the item text. Standard activation requires the user to double-click to activate an item, but the item does not change appearance.

The ListView control also supports the visual styles and other features available on the Windows XP platform, including grouping, tile view, and insertion marks.

See also