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

ListBox Virtualization initially creates too many items #2259

Closed
ahopper opened this issue Jan 22, 2019 · 4 comments · Fixed by #9677
Closed

ListBox Virtualization initially creates too many items #2259

ahopper opened this issue Jan 22, 2019 · 4 comments · Fixed by #9677
Assignees

Comments

@ahopper
Copy link
Contributor

ahopper commented Jan 22, 2019

If a ListBox is created with a large collection, too many items are materialized.
This

// If infinity is passed as the available size and we're virtualized then we need to

causes enough to fill the whole screen to be created initially. Once the measurement has sorted itself out the correct number exist. This is a big performance hit for lists using only part of the display.
Repro - run virtualization demo and count the number of materialized items

@grokys grokys self-assigned this Jan 22, 2019
@grokys
Copy link
Member

grokys commented Jan 25, 2019

Yeah, I'm not sure what to do about this. We need to work out the desired size given the constraints on the measure pass, and the only way to really do that is to materialize enough items.

Once WPF is open sourced, I intend to take a look at their code and try to work out how they do this.

@donandren
Copy link
Contributor

I have an idea:
what about search up the tree first parent with non empty bounds and if not found use 0 in measure phase and use the available space in arrange phase.

@ahopper
Copy link
Contributor Author

ahopper commented Jan 25, 2019

I did try setting width/height to zero if infinity and it worked for my code and the virtualization demo but some tests failed

@ahopper
Copy link
Contributor Author

ahopper commented Feb 1, 2019

A work around for some cases is to set the Height on the VirtualizingStackPanel in the ItemsPanelTemplate of a ListsBox, simply setting Height on the ListBox does not prevent the issue.

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

Successfully merging a pull request may close this issue.

3 participants