Export (0) Print
Expand All

ListView.ShowItemToolTips Property

Gets or sets a value indicating whether ToolTips are shown for the ListViewItem objects contained in the ListView.

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

public bool ShowItemToolTips { get; set; }

Property Value

Type: System.Boolean
true if ListViewItem ToolTips should be shown; otherwise, false. The default is true.

If the ShowItemToolTips property is set to true, any ListViewItem that has a ToolTip will display it; otherwise, nothing is displayed.

The following code example demonstrates how to use the ShowItemToolTips and ListViewItem.ToolTipText properties. To run this example, paste the code into a Windows Form and call InitializeItemsWithToolTips from the form's constructor or Load event handler.

// Declare the ListView. 
private ListView ListViewWithToolTips;
private void InitializeItemsWithToolTips()
{

    // Construct and set the View property of the ListView.
    ListViewWithToolTips = new ListView();
    ListViewWithToolTips.Width = 200;
    ListViewWithToolTips.View = View.List;

    // Show item tooltips.
    ListViewWithToolTips.ShowItemToolTips = true;

    // Create items with a tooltip.
    ListViewItem item1WithToolTip = new ListViewItem("Item with a tooltip");
    item1WithToolTip.ToolTipText = "This is the item tooltip.";
    ListViewItem item2WithToolTip = new ListViewItem("Second item with a tooltip");
    item2WithToolTip.ToolTipText = "A different tooltip for this item.";

    // Create an item without a tooltip.
    ListViewItem itemWithoutToolTip = new ListViewItem("Item without tooltip.");

    // Add the items to the ListView.
    ListViewWithToolTips.Items.AddRange(new ListViewItem[]{item1WithToolTip, 
        item2WithToolTip, itemWithoutToolTip} );

    // Add the ListView to the form. 
    this.Controls.Add(ListViewWithToolTips);
    this.Controls.Add(button1);
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft