问题描述
大家好,
我正在创建一个包含很多页面的应用程序.每页上都有一张图像.将图像加载到事件受保护的覆盖无效void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)"中.
I'm creating an app with a lot of pages. On every page there's one image. The image is loaded in the event "protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)" .
当我在两页之间导航时,由于图像正在加载,屏幕会变黑一秒钟.
When I navigate between two pages the screen turns black for a second because the image is loading.
我想知道应该使用线程还是异步事件?
I'm wondering if I should use a thread or an async event?
这是我加载图像的方式.
This is the the way I load the image.
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream stream = new IsolatedStorageFileStream("AppData\\" + url, FileMode.Open, file);
image.Source = _image.SetSource(stream);
stream.Close();
}
有没有一种方法可以首先快速加载没有图像的页面.准备好图像后,应该可以平滑地看到它.
Is there a way to first load the page fast without the image. When the image is ready it should be smoothly be visible.
谢谢大家.
推荐答案
这篇关于加载页面后逐页加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!