Gridview与空白缩略图 [英] Gridview with blank thumbnails
问题描述
我正在构建一个非常简单的Windows手机应用程序,其中包含一个gridview,显示通过FileOpenPicker选择的一些图像的缩略图。
要加载缩略图,我使用getThumbnailAsync并将其添加到ObservableCollection,我稍后将其绑定到GridView。
现在,如果我使用
await file.GetThumbnailAsync(ThumbnailMode.PicturesView);
它工作得很好但是也是这样慢。现在 如果我使用
file.GetThumbnailAsync(ThumbnailMode.PicturesView);
没有"await"它真的很快,但大多数缩略图(主要是来自高照片的缩略图)显示为空白(透明)缩略图 在gridview中。
我想知道如何获得流畅的体验,比如Windows手机上的图库,在那里创建空白的地方并用缩略图填充之后,你们有没有任何想法怎么做?
PS:gridview.updateLayout对此不起作用。
谢谢,
Tp。
< span style ="color:#4ec9b0; font-size:small">
嗨Tp,</ p>
不太确定为什么没有等待应用程序仍然可以看到缩略图,一般来说,没有await关键字,返回值应该是
IAsyncOperation< StorageItemThumbnail> 这是一个IAsyncOperation而不是StorageItemThum也许缩略图来自缓存。
除了基于文档:
缩略图,使用PictureView可能需要190 * 130像素,使用listView或documentView可以帮助渲染更小的尺寸,有助于提高渲染速度。
- 詹姆斯
Hi,
I am building a very simple Windows phone app with a gridview that shows some thumbnails for some images chosen through FileOpenPicker.
To load the thumbnail, I use the getThumbnailAsync and add it to an ObservableCollection which I bind later to a GridView.
Now, If I use
await file.GetThumbnailAsync(ThumbnailMode.PicturesView);
It works just fine but is way too slow. Now if I use
file.GetThumbnailAsync(ThumbnailMode.PicturesView);
without the "await" it is really fast, but most of the thumbnails(mainly the ones from highres pictures) appear as blank(transparent) thumbnails in the gridview.
I would like to know how to get a fluid experience, like the gallery on Windows phone, where it creates blank places and fill it with thumbnails after, do you guys have any idea how to do it?
PS: gridview.updateLayout does not work for this.
Thanks,
Tp.
Hi Tp,
Not quite sure why without await the app can still see the thumbnails, in general, without await keyword, the return value should be IAsyncOperation<StorageItemThumbnail> which is an IAsyncOperation instead of the StorageItemThumbnail, perhaps the thumbnails comes from the cache.
Besides base on the documentation: Thumbnails, using PictureView might take 190*130 pixels, using listView or documentView can help to render a smaller size, could help to improve the render speed.
--James
这篇关于Gridview与空白缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!