c# - 如何在 Windows 10 uwp 中禁用 xaml 优化?

标签 c# xaml winrt-xaml windows-10 uwp

我正在开发一个 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>

从值转换器中,我获取图像并将它们转换为用于绑定(bind)的位图图像。 图片供引用enter image description here

最佳答案

好吧,我通过包围 <GridView> 解决了这个问题与 <ScrollViewer> 。这将禁用 gridview 优化。请注意,这是一种解决方法,可能会以其他方式影响 gridview 的性能。使用它需要您自担风险。

关于c# - 如何在 Windows 10 uwp 中禁用 xaml 优化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32561532/

相关文章:

c# - 没有找到合适的方法来覆盖 webapi

c# - Web 浏览器控件在调用表单提交方法时在 IE 中打开下一页

c# - Windows 10 通用应用程序中的事件记录器

xaml - 一旦设置了所有依赖属性,是否会触发一个事件?

sqlite - 使用 SQLite-WinRT 包装器构建问题

c# - 发生异常时,我应该如何处理 C# 应用程序中的退避或 "Wait and Retry"逻辑?

C# Language : generics, open/closed, bound/unbound, constructed

c# - 创建一个覆盖层以禁用所有其他表单元素

WPF 使用 Canvas 作为 ImageSource

c# - UWP Xaml Textblock 数据绑定(bind) - 即使更新属性,UI 也不更新