tags:

views:

153

answers:

2

I have ListView and few columns of fixed size

the text lenghth i fill in the column may exceed the fixed length of column
so when user rests the mouse on that ListviewItem, a tooltip should be shown expanding the item

I tried

        ListViewItem iListView = new ListViewItem("add");

        iListView.ToolTipText = "Add Expanded";
        myListView.Items.Add(iListView);

But no Use

+2  A: 

Set the ListView's ShowItemToolTips property to true.

SLaks
Yup that works, Thanks a lot
Gaddigesh
A: 

Use ListViewItem.ToolTipText Property

// 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);
}
KMan
That's _exactly_ what he's already doing.
SLaks
@SLaks: Thats a snip from the link I added; just that I should have added more lines. Thanks for pointing out.
KMan