I’m still fairly new at using ListViews so this may seem like an elementary question, but how exactly would I go about listing one item per row?
For example, my code which displays all the files from a folder looks like this:
string[] files = Directory.GetFiles(Properties.Settings.Default.workspace + Path.DirectorySeparatorChar + "system" + Path.DirectorySeparatorChar + "app");
foreach (string file in files)
{
string fileName = Path.GetFileName(file);
ListViewItem item = new ListViewItem(fileName);
item.Tag = file;
listView1.Items.Add(item);
}
In turn the output looks like this:
SomeFile1 SomeFile2 SomeFile3 SomeFile4
SomeFile5 SOmeFile6 SOmeFile 7 SomeFile 8
My goal is to try to get it to look like this:
someFile 1
SomeFile 2
SomeFile 3
...
I know it has something to do with how I added the items, but I’m still not too sure.
Set
listView1.View= View.List, it should work.By default it’s set to
LargeIcon.You can set this property in constructor or by properties menu.