-api-id | -api-type |
---|---|
E:Windows.UI.Xaml.Media.Imaging.BitmapImage.DownloadProgress |
winrt event |
Occurs when a significant change has occurred in the download progress of the BitmapImage content.
<BitmapImage DownloadProgress="eventhandler"/>
For cases where the async loading and decoding of a BitmapImage object are long enough to be noticeable to the user, an app can handle DownloadProgress on the source and display a ProgressRing or ProgressBar to indicate the progress state. These might display in the UI region that the image eventually displays in, or somewhere else in the UI. Use DownloadProgressEventArgs.Progress to modify the UI for a ProgressBar.
// somewhere in initialization
bitmapImage.DownloadProgress += new EventHandler<DownloadProgressEventArgs>(bi_DownloadProgress);
bitmapImage.ImageOpened += new EventHandler<ExceptionRoutedEventArgs>(bi_ImageOpened);
...
//progressBar is an existing control defined in XAML or extracted from a XAML template
void bi_DownloadProgress(object sender, DownloadProgressEventArgs e)
{
progressBar.Value = e.Progress;
}
void bi_ImageOpened(object sender, RoutedEventArgs e)
{
progressBar.Visibility = Visibility.Collapsed;
}