C# - Printing out groupnames, items and subitems in a loop?
- by Nike
What I'm trying to do, is to store all groupnames, items and subitems from a listview into a string. Take a look at the following screenshot.
I'm kind of stuck though, with the loop. I'm pretty sure i can figure out how to actually store it in a variable though.
The following code will loop through all of the listview Items:
int countGroups = csslistview.Items.Count;
foreach (ListViewItem lvi in csslistview.Items){
//code here
countGroups++;
}
But i can't figure out how to loop through all of the Groups. I tried this, but it's not working:
int countGroups = csslistview.Groups.Count;
foreach (ListViewItem lvi in csslistview.Items){
//code here
countGroups++;
}
I'm trying to echo it out as CSS, if you're wondering. The grouname is the id/class/tag, the item is the rule, and the subitem is the property.
So, any ideas?