Export (0) Print
Expand All
Key
M11
M12
M21
M22
Tag
Uri
X1
X2
Y1
Y2
Expand Minimize

DownloadProgress (Downloader)

Silverlight

Gets a value that indicates the relative progress of downloaded content.

value = downloaderObject.DownloadProgress

Type: Double

A value between 0 and 1, inclusive, that represents the amount of total content that is downloaded. Multiply by 100 to obtain a percentage.

This property is read-only. The default value is 0.

None. Downloader does not exist in the managed API. Generally you can use WebClient for downloads, which provides equivalent functionality.

As soon as you invoke the Send method on the Downloader object, you can check the DownloadProgress property to determine the percentage of total content that has been downloaded. The return value is expressed as double value between 0 and 1.0, inclusive, with 0 representing no content downloaded, and 1.0 representing all content downloaded.

The DownloadProgressChanged event can be used monitor the progress of a download request. The DownloadProgressChanged event occurs whenever the percentage of total content that is downloaded increases by 0.05 or more, or reaches 1.0.

The following JavaScript example shows how to use the DownloadProgress property in a DownloadProgressChanged event handler function.

// Event handler for updating visual progress indicator
function onDownloadProgressChanged(sender, eventArgs)
{
    // Calculate the downloaded percentage.
    var percentage = Math.floor(sender.downloadProgress * 100);

    // Update the Rectangle and TextBlock objects of the visual progress indicator.
    progressText.text = percentage + "%";
    progressRectangle.width = percentage * 2; 
}

A visual progress indicator can be constructed from a wide variety of XAML content, including animated objects.

Community Additions

ADD
Show:
© 2014 Microsoft