Bohn
Bohn

Reputation: 26929

Prevent listview items from showing in a second column

I am working with Winforms using C#.

It is easier to explain my question with a screen shot:

The list view on the left, notice how items15 and later are showing in a second column. I don't want that. I want it to have a vertical scroll bar and items15 to appear under item14, etc..not in a new column. I have set the "view" property on "List" too.

enter image description here

Thanks all.

Upvotes: 0

Views: 490

Answers (1)

eMi
eMi

Reputation: 5628

You need to Set

listview.Scrollable = true;
listview.View = View.Details
listview.HeaderStyle = ColumnHeaderStyle.None;

Add a dummy column, its an important step, cause we changed the View to details:

    ColumnHeader header = new ColumnHeader();
    header.Text = "MyHeader";
    header.Name = "MyColumn1";
    listView.Columns.Add(header);

Upvotes: 1

Related Questions