Share via

ListViewItem.ImageKey Property


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

 property System::String ^ ImageKey { System::String ^ get(); void set(System::String ^ value); };
public string ImageKey { get; set; }
member this.ImageKey : string with get, set
Public Property ImageKey As String

Property Value

The key for the image that is displayed for the ListViewItem.



ImageKey and ImageIndex are mutually exclusive, meaning if one is set, the other is set to an invalid value and ignored. If you set the ImageKey property, the ImageIndex property is automatically set to -1. Alternatively, if you set the ImageIndex property, the ImageKey is automatically set to an empty string ("").


If you are using multiple image lists, for small and large icon view, with a 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.

Applies to