简体   繁体   中英

Get VariableSizedWrapGrid to virtualise

I have a gridview. But since i am dumping a lot of data into it, it's throwing an overload exception.

I can solve this on a normal gridview by setting a width and height, it will then virtualise the data.

The difference here is i have also set the items panel. This is preventing the virutalisation to kick in.

I can get it working again by setting a width on the VariableSizedWrapGrid but this is not showing a scrollbar, making it pretty useless.

    <GridView x:Name="ItemGridView" Width="500" Height="400" ItemsSource="{Binding ItemList}" Margin="6" Grid.Row="1">
        <GridView.ItemsPanel>
            <ItemsPanelTemplate>
                <VariableSizedWrapGrid Width="450" Height="350" />
            </ItemsPanelTemplate>
        </GridView.ItemsPanel>

Any ideas how i can get this combination working?

Maybe you could put your GridView in the ScrollViewer element like:

 <ScrollViewer>
  <Grid>
   <GridView x:Name="ItemGridView" Width="500" Height="400" ItemsSource="{Binding ItemList}" Margin="6" Grid.Row="1">
        <GridView.ItemsPanel>
            <ItemsPanelTemplate>
                <VariableSizedWrapGrid Width="450" Height="350" />
            </ItemsPanelTemplate>
        </GridView.ItemsPanel>
    </GridView >
  </Grid>
</ScrollViewer>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM