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);
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft