MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
227 stars 495 forks source link

ListView needs to be bounded to enable virtualization #1021

Open MikeHillberg opened 5 years ago

MikeHillberg commented 5 years ago

ListView is intelligent about not creating more item container elements than are necessary to fill the screen (plus some caching). But that only works if it knows the bounds. If you put a ListView in something like a StackPanel or ScrollViewer, there are no bounds, and the UI virtualization is broken. This should be called out as a note in this documentation.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Karl-Bridge-Microsoft commented 3 years ago

Hi @MikeHillberg - Thanks for taking the time to let us know about this issue and we sincerely apologize for the delayed response.

This topic contains a link to the https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/optimize-gridview-and-listview topic, which seems to address your concern in some depth.

Does this address your issue adequately?

HO-COOH commented 5 months ago

Just searched about this topic, and I think that's not clear enough. The doc only mentioned about ItemsPanel, but I think what OP means is that the container of the whole ListView should have size limit. If you do something like this

<Page>
    <StackPanel>
        <ListView .../>
    </StackPanel>
</Page>

then there will be no virtualization.