-
May 27th, 2009, 06:22 AM
#1
Thread Starter
Hyperactive Member
Listview
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
-
May 27th, 2009, 06:30 AM
#2
Re: Listview
If you are coding in VB, then it should work the same
vb.net Code:
Dim lvwItem As New ListViewItem()
lvwItem = ListView1.Items.Add("blah")
lvwItem.SubItems.Add("More Blah")
'etc
-
May 27th, 2009, 07:27 AM
#3
Re: Listview
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
Last edited by chris128; May 27th, 2009 at 07:34 AM.
-
May 27th, 2009, 11:57 PM
#4
Thread Starter
Hyperactive Member
Re: Listview
I did it this way.
Code:
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
But the result I get in the ListView is
ListViewItem:{test} ListViewItem:{test}
What could be wrong?
-
May 28th, 2009, 03:36 AM
#5
Re: Listview
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
Last edited by chris128; May 28th, 2009 at 03:39 AM.
-
Jun 1st, 2009, 07:20 AM
#6
Re: Listview
Originally Posted by chris128
No its not the same Hack, the ListViewSubItem class doesnt exist in WPF.
Thanks!
After looking around a bit, I found this. Hopefully it will be useful.
http://www.switchonthecode.com/tutor...istview-part-1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|