System.Windows.Forms.ListViewItem.ImageKey Property

Gets or sets the key for the image that is displayed for the item.

Syntax

[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ImageKeyConverter))]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
[System.ComponentModel.Editor("System.Windows.Forms.Design.ImageIndexEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))]
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.Localizable(true)]
[System.ComponentModel.DefaultValue("")]
public string ImageKey { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The ListViewItem.ImageKey property returns an empty string ("") when the ListViewItem.ImageKey is not set for the System.Windows.Forms.ListViewItem. The ListViewItem.ImageKey and ListViewItem.ImageIndex properties are mutually exclusive, meaning if one is set, the other is ignored. If you set the ListViewItem.ImageKey property, the ListViewItem.ImageIndex property is automatically set to -1. Alternatively, if you set the ListViewItem.ImageIndex property, the ListViewItem.ImageKey is automatically set to an empty string ("").

Note:

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.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0