开发者

WinForm ListView Layout Issues

enter code hereI'm having an issue with setting the layout for my ListView. I must be missing something simple.

All I want is a list that has one item per row and instead its making the list run from left to right.

WinForm ListView Layout Issues

public Form1()
{
    InitializeCompone开发者_开发百科nt();
    Items = new List<Item>();
    listView1.FullRowSelect = true;
    this.listView1.Columns.Add("Path", listView1.Width, HorizontalAlignment.Left);
}

public void Blah(){
    listView1.Items.Clear();
    foreach (Item item in Items)
    {
       string s = String.Format("{1}", item.Type, item.Path);
       ListViewItem lvi = new ListViewItem();
       lvi.Text = s;
       listView1.Items.Add(lvi);
     }
 }


Found it..

add listView1.View = View.Details; to the constructor and magic happens.

I hope this saves someone some time.

WinForm ListView Layout Issues

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜