Pergunta

Like on the pic, there is second column header and two subheaders under it ?

enter image description here

Foi útil?

Solução

For a complete example look at this link this should give you a full working example of what you can do Add ListView Column and Insert Listview Items

try something like this

The order in which you add values to the array dictates the column they appear under so think of your sub item headings as [0],1 etc.

Here's a code sample:

//In this example an array of three items is added to a three column listview string[] saLvwItem = new string[2];

foreach (string wholeitem in listofitems)
{
     saLvwItem[0] = "Status Message";
     saLvwItem[1] = wholeitem;
     ListViewItem lvi = new ListViewItem(saLvwItem);

     lvwMyListView.Items.Add(lvi);
}

To add SubItems you could also do something like this

lvwMyListView.Items[0].SubItems.Add("John Smith");
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top