Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FastObjectListView in LargeIcon view with groups #10

Open
rrirower opened this issue Nov 19, 2021 · 3 comments
Open

FastObjectListView in LargeIcon view with groups #10

rrirower opened this issue Nov 19, 2021 · 3 comments

Comments

@rrirower
Copy link

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?

@rrirower
Copy link
Author

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.

Is this an appropriate workaround?

@thracx
Copy link

thracx commented Jan 6, 2022

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.

@rrirower
Copy link
Author

rrirower commented Jan 6, 2022

Thanks for the reply. However, I reverted back to using the WinForms ListView since nothing I tried worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants