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 */
public boolean get_ShowItemToolTips ()

/** @property */
public void set_ShowItemToolTips (boolean value)

public function get ShowItemToolTips () : boolean

public function set ShowItemToolTips (value : boolean)

Not applicable.

Property Value

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 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft