Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.77 KB

bitmapimage_downloadprogress.md

File metadata and controls

48 lines (34 loc) · 1.77 KB
-api-id -api-type
E:Windows.UI.Xaml.Media.Imaging.BitmapImage.DownloadProgress
winrt event

Windows.UI.Xaml.Media.Imaging.BitmapImage.DownloadProgress

-description

Occurs when a significant change has occurred in the download progress of the BitmapImage content.

-xaml-syntax

<BitmapImage DownloadProgress="eventhandler"/>

-remarks

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.

-examples

// 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;
}

-see-also

DownloadProgressEventArgs, ProgressBar