Reputation: 1967
I'm developing a windows 10 uwp app. I have a gridview which contains images and are bound at run-time dynamically from the c# end but when i scroll down fast sometimes and scroll up again some images disappear leaving a blank spot.I have done the same in windows phone 8.1 without any problem but here I think there is some xaml optimization, hence was wondering how to disable this?
XAML Code:
<GridView x:Name="gv" Margin="8,0,8,8"
Grid.Row="1"
SizeChanged="GridView_SizeChanged"
IsItemClickEnabled="True"
ItemClick="gv_ItemClick"
SelectionMode="Single">
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
</Style>
</GridView.ItemContainerStyle>
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<Image Source="{Binding Thumbnail,Converter={StaticResource imageConverter}}"
Stretch="UniformToFill" />
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
And from the a value converter I'm getting images and converting them to Bitmap Image for Binding. Image for reference
Upvotes: 2
Views: 1635
Reputation: 1967
Okay I solved this by surrounding the <GridView>
with a <ScrollViewer>
.This will disable the gridview optimization. Please note this is a workaround and and can affect the performance of the gridview in other ways. Use it at your own risk.
Upvotes: 3