Hi,
How do I add a subitem to a listview in WPF? I'm coding in VB and I do not see any subitem in it.
Thanks
Printable View
Hi,
How do I add a subitem to a listview in WPF? I'm coding in VB and I do not see any subitem in it.
Thanks
If you are coding in VB, then it should work the samevb.net Code:
Dim lvwItem As New ListViewItem() lvwItem = ListView1.Items.Add("blah") lvwItem.SubItems.Add("More Blah") 'etc
No its not the same Hack, the ListViewSubItem class doesnt exist in WPF.
Have a look at the link in my signature titled something like "Editable Listview in WPF" and that should give you a good idea how to do what you want.
Post back here if you get stuck :)
Also, in this WPF forum there is a thread titled "WPFisms: Tips Tricks and Changes from Winforms", which highlights this difference :)
http://www.vbforums.com/showthread.php?t=555189
I did it this way.
But the result I get in the ListView isCode:For Each blk In blks
If blk.IsXRef Then
Dim intIndex As Integer = Array.IndexOf(Src, blk.Name.ToString)
If intIndex >= 0 Then
lvi.Text = blk.Name
lvi.SubItems(0).Text = "test"
LV.Items.Add(lvi)
End If
End If
Next
ListViewItem:{test} ListViewItem:{test}
What could be wrong?
Did you look at the thread I mentioned (in my signature) at all?
You can bind the listview to your collection and then use the DisplayMemberBinding property of each column in the listview to select which columns show which properties from your collection
Thanks!
After looking around a bit, I found this. Hopefully it will be useful.
http://www.switchonthecode.com/tutor...istview-part-1