DownloadProgress Property (Downloader)

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

XAML
Cannot be used in XAML.
Scripting
value = downloaderObject.DownloadProgress

Property Value

Double

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

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

Remarks

Once you have invoked the Send method on the Downloader object, the DownloadProgress property allows you to determine the percentage of total content 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 downloaded increases by 0.05 or more, or reaches 1.0.

Examples

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

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

The following illustration shows the visual progress indicator at the starting, middle, and ending position of the download.

Visual progress indicator

Visual progress indicator

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

Applies To

Downloader

See Also

Using a Downloader Object
DownloadProgressChanged
Send