This documentation is archived and is not being maintained.

TreeView.SelectedImageKey Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the key of the default image shown when a TreeNode is in a selected state.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in

public string SelectedImageKey { get; set; }
/** @property */
public String get_SelectedImageKey ()

/** @property */
public void set_SelectedImageKey (String value)

public function get SelectedImageKey () : String

public function set SelectedImageKey (value : String)

Property Value

The key of the default image shown when a TreeNode is in a selected state.

If a TreeNode does not have a selected image set, the image specified by the SelectedImageKey property will be shown when the node is not selected.

The SelectedImageKey and SelectedImageIndex properties are mutually exclusive, meaning if one is set, the other is ignored. If you set the SelectedImageKey property, the SelectedImageIndex property is automatically set to -1. Alternatively, if you set the SelectedImageIndex property, the SelectedImageKey is automatically set to an empty string ("").

TreeView treeViewWithToolTips;
private void InitializeTreeViewWithToolTips()
    treeViewWithToolTips = new TreeView();
    TreeNode node1 = new TreeNode("Node1");
    node1.ToolTipText = "Help for Node1";
    TreeNode node2 = new TreeNode("Node2");
    node2.ToolTipText = "A Tip for Node2";
    treeViewWithToolTips.Nodes.AddRange(new TreeNode[] { node1, node2 });
    treeViewWithToolTips.ShowNodeToolTips = true;


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0