Adding Columns to a ListView

Hi everyone,
I'm trying to populate a ListView control using code in C#. While I am able to display one column of information, how can I add an extra column?

For example, this is the code I have so far for just displaying the first name.

for (int i = 0; i < 100; i++) {
ListViewItem foo = new ListViewItem();
foo.Content = "First Name: " + i;
// ucMain = ListView created in EID (Sparkle)
ucMain.Items.Add(foo);
}

In several of the online examples, especially those created in VB, the listviewitem seems to have a subitem method, but I can't find the WPF equivalent to use in C#.

Thanks,
Kirupa

[740 byte] By [kirupa] at [2007-12-22]
# 1

you can create a class and add objects of that class as Items. the properties of the object can be used for columns.

I dont think there is something like subitem

leed at 2007-8-30 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2

Thanks for the response Lee. That seems like a pretty roundabout way of adding data to a ListView. Is that the only/most common approach?

Thanks,
Kirupa

kirupa at 2007-8-30 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 3
I guess so, or you can use xmlprovider for xmldata
leed at 2007-8-30 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified