ListView add and group items
-
How do i add items and group them in a ListView? Im using this to add a new item: ListView1.Items.Add("ITEM1", 0) And this for making a Group: ListView1.Groups.Add(0, "Group1") But how do I make "ITEM1" part of the group "Group1" THX
Looks like this article may have what you are looking for: ListView Grouping XP Style
-
Looks like this article may have what you are looking for: ListView Grouping XP Style
-
thanks for your reply i downloaded the project it is in c# so im not sure if i understand it all, but i give it a try
Why not use the XPListView user control "as is" in your project? Just add the user control to your project and use it instead of the standard listview control. The XPListView control has two properties that makes grouping automatic ... AutoGroupMode and AutoGroupColumn.
-
Why not use the XPListView user control "as is" in your project? Just add the user control to your project and use it instead of the standard listview control. The XPListView control has two properties that makes grouping automatic ... AutoGroupMode and AutoGroupColumn.
-
Yup, here is a simple example.
Private Sub Form1\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Add a column to the listview ListView1.Columns.Add("Name") ' Create two groups ListView1.Groups.Add("Group1", "Group1") ListView1.Groups.Add("Group2", "Group2") ' Add two items and assign them to the desired group ListView1.Items.Add("Test Group1").Group = ListView1.Groups("Group1") ListView1.Items.Add("Test Group2").Group = ListView1.Groups("Group2") ' Add another item differently and give it a group ListView1.Items.Add(New ListViewItem("Test Group1 again", ListView1.Groups("Group1"))) ListView1.View = View.Details ' Basically you need to know that the groups collection is where you ' add groups to the listview ' I've showed two different ways you can add an item and assign it to a group ' This should give you an idea how to work with groups End Sub
-
Yup, here is a simple example.
Private Sub Form1\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Add a column to the listview ListView1.Columns.Add("Name") ' Create two groups ListView1.Groups.Add("Group1", "Group1") ListView1.Groups.Add("Group2", "Group2") ' Add two items and assign them to the desired group ListView1.Items.Add("Test Group1").Group = ListView1.Groups("Group1") ListView1.Items.Add("Test Group2").Group = ListView1.Groups("Group2") ' Add another item differently and give it a group ListView1.Items.Add(New ListViewItem("Test Group1 again", ListView1.Groups("Group1"))) ListView1.View = View.Details ' Basically you need to know that the groups collection is where you ' add groups to the listview ' I've showed two different ways you can add an item and assign it to a group ' This should give you an idea how to work with groups End Sub
-
That's interesting. I downloaded and then opened the XPListView solution in VS 2005 and the project was successfully converted from 2003 to 2005. Then I built the user control using VS 2005. There were no errors either in the conversion or the build. I added the re-built XPListView DLL to the VS 2005 Toolbox and then pasted the XPListView control onto a form in a test project. It works great and I now have the extended listview available for all of my projects.
-
That's interesting. I downloaded and then opened the XPListView solution in VS 2005 and the project was successfully converted from 2003 to 2005. Then I built the user control using VS 2005. There were no errors either in the conversion or the build. I added the re-built XPListView DLL to the VS 2005 Toolbox and then pasted the XPListView control onto a form in a test project. It works great and I now have the extended listview available for all of my projects.
-
can you email me your (converted) project? and the dll? i dont understand why i got so many errors, i cant even open the form designer becouse of all the errors. ive removed the AT for spam reasons. svanheest gmail.com thanks!!