Documentation for this section has not yet been entered.
The ListView.View property allows you to specify the type of display the System.Windows.Forms.ListView control uses to display items. You can set the ListView.View property to display each item with large or small icons or display items in a vertical list. The richest option is the details view, which allows you to view not only the items but any subitems specified for each item. Each item is displayed in a grid, with each item listed vertically and the subitems for each item displayed in a column, with column headers. The details view is a perfect way to display database information to a user. With Windows XP and Windows Server 2003, you can also display items as tiles that balance graphical and textual information by showing a large icon along with subitem information of your choosing. To enable tile view, your application must call the Application.EnableVisualStyles method. The small-image view displays each item with an icon and textual information to the right of the icon. The large-image view displays each item with an icon and textual information below the icon. The size of the icons for the image list is specified by the ImageList.ImageSize property of the System.Windows.Forms.ImageList for the ListView.SmallImageList or ListView.LargeImageList properties.
If you are using multiple image lists, for small and large icon view, with a System.Windows.Forms.ListView control, you should place small and large versions of the image at the same index location in their respective image lists. When switching between views, the index location of the image in one list is used to locate the image in the other list, regardless of the key value specified.
Most of the properties in the System.Windows.Forms.ListView control affect how the different views behave or are displayed. Some properties that affect the views of the items are only useful when the ListView.View property is set to a specific value, while others are useful in all views. For example, properties such as ListView.GridLines and ListView.FullRowSelect are only useful when the ListView.View property is set to View.Details, while the ListView.MultiSelect and ListView.CheckBoxes properties are useful in all views.
The following table shows some of the System.Windows.Forms.ListView members and the views they are valid in.
ListView.Alignment property | |
ListView.AutoArrange property | |
ListView.AutoResizeColumn(int, ColumnHeaderAutoResizeStyle) method | |
ListView.CheckBoxes |
All views except View.Tile |
ListView.Columns property | |
ListView.DrawSubItem event | |
erload:System.Windows.Forms.ListView.FindItemWithText method | |
erload:System.Windows.Forms.ListView.FindNearestItem method | |
ListView.GetItemAt(int, int) method | |
ListView.Groups property |
All views except View.List |
ListView.HeaderStyle property | |
ListView.InsertionMark property |
You can use the ListView.View property to provide different views of data in your application, or to lock a specific view to utilize that view's benefits. For example, the ListView.View property is often set to View.Details because the details view provides a number of viewing options not available in the other views.
If your System.Windows.Forms.ListView control does not have any column headers specified and you set the ListView.View property to View.Details, the System.Windows.Forms.ListView control will not display any items. If your System.Windows.Forms.ListView control does not have any column headers specified and you set the ListView.View property to View.Tile, the System.Windows.Forms.ListView control will not display any subitems.
The tile view displays each item with a large icon on the left and textual information on the right. The textual information consists of the item label followed by subitems. By default, only the first subitem is displayed, which corresponds to the item label. To display additional subitems, you must add System.Windows.Forms.ColumnHeader objects to the ListView.Columns collection. Each subitem in the tile corresponds to a column header. To control which subitems are displayed and the order in which they are displayed, you must set the System.Windows.Forms.ListViewItem.ListViewSubItem.Name property for each item and the ColumnHeader.Name property for each header. You can then add, remove, and rearrange headers in the ListView.Columns collection to achieve the desired result.
To control the size of the tiles in the tile view, set the ListView.TileSize property. This is useful to prevent line-wrapping when subitem text is too long for a single line.
For an example of the tile view, see the ListView.TileSize property.
Although columns are only displayed in the details view, subitems without column headers will not display in either the details view or the tile view.
The tile view is available only on Windows XP and Windows Server 2003 when your application calls the Application.EnableVisualStyles method. On earlier operating systems, any code related to the tile view has no effect, and the System.Windows.Forms.ListView control displays in the large icon view. As a result, any code that depends on the tile view might not work correctly.
You might want to include code that determines whether tile view is available, and provide alternate functionality when it is unavailable. For example, when you use owner drawing to customize the appearance of System.Windows.Forms.ListView items in the tile view, you might want to use drawing code appropriate to the large icon view when running on operating systems that do not support the tile view.
The tile view feature is provided by the same library that provides the operating system themes feature. To check for the availability of this library, call the FeatureSupport.IsPresent(object) method overload and pass in the OSFeature.Themes value.