You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to convert a ListView in LargeIcon view to a FastObjectListView that uses groups. The code throws an exception while trying to define the groups:
"When the ListView is in virtual mode, you cannot enumerate through the ListView items collection using an enumerator or call GetEnumerator. Use the ListView items indexer instead and access an item by index value."
UPDATE: I found a workaround. I'm not sure it's appropriate, but, it seems to work. I set the ListView property 'VirtualMode' to false. The code does not throw an exception and now fills the groups programmatically.
That is certainly appropriate if you know you won't need to use VirtualMode. VirtualMode performs much better but it makes the control harder to use (i.e. you loose certain accessors).
VirtualMode is for when the # of items 'in' the list is too large (either too large to load from source like a database, or too large to be useful to the user and so wasteful to draw them all). If you know your list is always small, or you know all the items will always be available, then you don't need VirtualMode.
I tried to convert a ListView in LargeIcon view to a FastObjectListView that uses groups. The code throws an exception while trying to define the groups:
"When the ListView is in virtual mode, you cannot enumerate through the ListView items collection using an enumerator or call GetEnumerator. Use the ListView items indexer instead and access an item by index value."
The exception occurs on this line in the code:
channellistView.Groups.Add(new ListViewGroup(category.name, HorizontalAlignment.Left));
I am adding the groups programmatically in the code. I set the flag 'ShowGroups' to true.
Is this possible? How can I add groups to a FastObjectListView in LargeIcon view? Is there a code sample or recipe?
The text was updated successfully, but these errors were encountered: