0

I have a requirement which is to display a user information at top of the page and a ListView of images will follow it, and I've wrote following code (it's a pseudocode but I think it's enough to explain what I've done):

    <ScrollViewer>
        <StackPanel>
            <Grid>
                <!-- User Information Part -->
            </Grid> 
            <ListView> 
                <!-- Images Part, This is a custom virtualized ListView, it's ItemsPanel is a custom VirtualizingWrapPanel -->
            </ListView>
        </StackPanel>
    </ScrollViewer>

But in this scenario, the VirtualizingWrapPanel (by which has been tested on another individual ListView without an explicit ScrollViewer declaration and it works correctly) and the virtualization of ListView won't work because the desired height of ScrollViewer is positive infinity and all the items in the ListView will be expanded and rendered, I wonder whether there is a way that can make the ListView in ScrollViewer being virtualizable? Thanks

Dylech30th
  • 157
  • 2
  • 10

1 Answers1

-1

You can't virtualize a list that has all elements being rendered (because of the StackPanel),

A workaround that will work for you: you need a single ListView. With the first row customized to display the User Information Part, and all other rows displaying images.

Maciek Świszczowski
  • 1,155
  • 11
  • 28
  • I didn't downvote, and I'd like to consider your suggest but seems it's not really possible to customize a specific row in a ListView by which has a WrapPanel as it's ItemsPanel – Dylech30th Jul 17 '20 at 03:06
  • It's possible to have a different DataTemplate for every row, and you can achieve it in a few different ways (e.g. with DataTemplateSelector) no matter what ItemsPanel is. – Maciek Świszczowski Jul 17 '20 at 21:21