WinForm ListView Layout Issues
enter code here
I'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.
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.
精彩评论