我正在开发一个 Windows 10 uwp 应用程序。我有一个包含图像的 gridview,它在运行时从 C# 端动态绑定(bind),但是当我有时快速向下滚动并再次向上滚动时,一些图像消失,留下一个空白点。我在 Windows Phone 8.1 中做了同样的事情,没有任何问题但这里我认为有一些 xaml 优化,因此想知道如何禁用它?
XAML 代码:
<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>
最佳答案
好吧,我通过包围 <GridView>
解决了这个问题与 <ScrollViewer>
。这将禁用 gridview 优化。请注意,这是一种解决方法,可能会以其他方式影响 gridview 的性能。使用它需要您自担风险。
关于c# - 如何在 Windows 10 uwp 中禁用 xaml 优化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32561532/