BitmapImage.DownloadProgress Kejadian

Definisi

Terjadi ketika perubahan signifikan telah terjadi dalam kemajuan pengunduhan konten BitmapImage .

public:
 virtual event DownloadProgressEventHandler ^ DownloadProgress;
// Register
event_token DownloadProgress(DownloadProgressEventHandler const& handler) const;

// Revoke with event_token
void DownloadProgress(event_token const* cookie) const;

// Revoke with event_revoker
BitmapImage::DownloadProgress_revoker DownloadProgress(auto_revoke_t, DownloadProgressEventHandler const& handler) const;
public event DownloadProgressEventHandler DownloadProgress;
function onDownloadProgress(eventArgs) { /* Your code */ }
bitmapImage.addEventListener("downloadprogress", onDownloadProgress);
bitmapImage.removeEventListener("downloadprogress", onDownloadProgress);
- or -
bitmapImage.ondownloadprogress = onDownloadProgress;
Public Custom Event DownloadProgress As DownloadProgressEventHandler 
<BitmapImage DownloadProgress="eventhandler"/>

Jenis Acara

Contoh

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

Keterangan

Untuk kasus di mana pemuatan asinkron dan pendekodean objek BitmapImage cukup lama untuk terlihat oleh pengguna, aplikasi dapat menangani DownloadProgress pada sumber dan menampilkan ProgressRing atau ProgressBar untuk menunjukkan status kemajuan. Ini mungkin ditampilkan di wilayah UI tempat gambar akhirnya ditampilkan, atau di tempat lain di UI. Gunakan DownloadProgressEventArgs.Progress untuk memodifikasi UI untuk ProgressBar.

Berlaku untuk

Lihat juga