ToolBoxTab3.ListView Property

Gets or sets a value indicating whether items in a particular ToolBox tab display in List view or Icon view format.

Namespace:  EnvDTE90
Assembly:  EnvDTE90 (in EnvDTE90.dll)

Syntax

'Declaration
Property ListView As Boolean
bool ListView { get; set; }
property bool ListView {
    bool get ();
    void set (bool value);
}
abstract ListView : bool with get, set
function get ListView () : boolean 
function set ListView (value : boolean)

Property Value

Type: System.Boolean
true if the ToolBox tab is in List view; otherwise, false.

Remarks

ListView applies on a tab-by-tab basis in the ToolBox. That is, one tab can have List view while another has Icon view.

The List and Icon views are similar to those in Windows Explorer. In List view, the contents of the Toolbox are listed as text descriptions, one after another, with an icon on the left side. In Icon view, each item is represented only by an icon. You can get a ToolTip description of the icon by rolling the mouse over it.

Examples

This example toggles the ListView property of a Toolbox tab. For more information about how to run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    ToolBoxListViewExample(_applicationObject)
End Sub
Sub ToolBoxListViewExample(ByVal dte As DTE2)
    Dim tlBox As ToolBox
    Dim tbxTabs As ToolBoxTabs
    Dim tbxTab As ToolBoxTab3
    Dim tbxItem As ToolBoxItem
    ' Before runiing this example, open a Windows Form project,
    ' and select Toolbox from the View menu.
    Try
        ' Create an object reference to the IDE's ToolBox object and
        ' its tabs.
        tlBox = CType(_applicationObject.Windows.Item _
         (Constants.vsWindowKindToolbox).Object, ToolBox)
        tbxTabs = tlBox.ToolBoxTabs
        ' Select the first ToolBox tab.
        tbxTab = CType(tbxTabs.Item(3), ToolBoxTab2)
        MsgBox(tbxTab.Name)
        tbxTab.Activate()
        tbxItem = tbxTab.ToolBoxItems.Item(1)
        MsgBox("Toolbox item name: " & tbxItem.Name)
        MsgBox("Turning Toolbox to List view...")
        tbxTab.ListView = False
        MsgBox("Turning Toolbox to Icon view...")
        tbxTab.ListView = True
    Catch ex As System.Exception
        MsgBox("ERROR: " & ex.Message)
    End Try
End Sub
using EnvDTE;
using EnvDTE80;
using EnvDTE90;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    ToolBoxListViewExample(_applicationObject);
}
public void ToolBoxListViewExample(DTE2 dte)
{
    ToolBox tlBox;
    ToolBoxTabs tbxTabs;
    ToolBoxTab3 tbxTab;
    ToolBoxItem tbxItem;
    // Before running this example, open a Windows Form project
    // and select Toolbox from the View menu.
    try
    {
        //Create an object reference to the IDE's ToolBox object and
        // its tabs.
        tlBox = (ToolBox)_applicationObject.Windows.Item
(Constants.vsWindowKindToolbox).Object;
        tbxTabs = tlBox.ToolBoxTabs;
        // Select the first Toolbox tab.
        tbxTab = (ToolBoxTab2)tbxTabs.Item(3);
        MessageBox.Show(tbxTab.Name);
        tbxItem = tbxTab.ToolBoxItems.Item(1);
        MessageBox.Show("Toolbox item name: " + tbxItem.Name);
        MessageBox.Show("Turning Toolbox to List view...");
        tbxTab.ListView = false;
        MessageBox.Show("Turning Toolbox to Icon view...");
        tbxTab.ListView = true;
    }
    catch (Exception ex)
    {
        MessageBox.Show("ERROR: " + ex.Message);
    }
}

.NET Framework Security

See Also

Reference

ToolBoxTab3 Interface

EnvDTE90 Namespace