I am setting a background image on my XAML Grid with a Uri. The Uri points off to a HTTP url, where it will fetch, and then render the image as a background for a Win8 metro app.
I've been trying to figure out if there is an event or something I can hook into to let me know that WPF has loaded it into memory, AND finished rendering it out of view.
Currently, a small image will load fast enough, and smoothly fade in. However, if I load a larger, slower image, it will take 100s of ms to show up as the background, which means it either pops up mid-fade, or after the fade effect has completed. This looks quite poor.
The goal is to have a fade transition between app pages (I already have this), without the inconsistency of the background image popping up whenever it's done.
Any suggestions would be welcomed.
You don't say exactly how you're loading the image but there's a DownloadCompleted event on BitmapImage, e.g.
BitmapImage bmp = new BitmapImage(imageUri);
bmp.DownloadCompleted += ReadyToDisplay;
Like Phil said, but then for Windows Store apps:
BitmapImage bmp = new BitmapImage(imageUri);
bmp.ImageOpened += ReadyToDisplay;
ImageOpened Occurs when the image source is downloaded and decoded with no failure. You can use this event to determine the size of an image before rendering it.
source: MSDN