I have a GridView with GridView.ItemsSource set to a collection that implements ISupportIncrementalLoading. By implementing this, I am aiming to improve load time and UI responsiveness by only loading items that are needed for display. The framework handles this for me and it works great.
<GridView ItemsSource="{Binding Items}">
<GridView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Text}"/>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
However, if I wrap the above XAML in a ScrollViewer like the following, the entire collection of Items loads as though the GridView is unable to tell where it's boundaries are.
<ScrollViewer>
<GridView ItemsSource="{Binding Items}">
<GridView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Text}"/>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</ScrollViewer>
I know that the ScollViewer will allow it's content to fill as much space as it wants, so the effect here does make sense; it is just an unforeseen annoyance. Does anyone have a solution to getting around this problem?
Note: I've simplified the code here for example sake. In case it helps to know what I'm trying to accomplish: my goal is to have an incrementally loaded GridView inside a HubSection on my Hub page. My hub page has 2 HubSections, one that is at 600px width and the other with the GridView in it with no width defined.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…