This documentation is archived and is not being maintained.

ToolBoxItems.SelectedItem Property

Gets the item currently selected in the tab of the ToolBox, if any exist.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

ToolBoxItem SelectedItem { get; }
/** @property */
ToolBoxItem get_SelectedItem ()

function get SelectedItem () : ToolBoxItem

Property Value

A ToolBoxItem object.

If no items exist in the ToolBox tab or if no item is selected, then SelectedItem returns Nothing.

public void SelectedItemExample(DTE2 dte)
    // Before running this example, select an item in the 
    // ToolBox window.

    ToolBoxTab tab = dte.ToolWindows.ToolBox.ActiveTab;
    ToolBoxItem item = tab.ToolBoxItems.SelectedItem;

    if (tab != null)
        MessageBox.Show("The selected toolbox item is " + item.Name);
        MessageBox.Show("No toolbox item is selected");