Occurs while content is being downloaded during a download request.
| XAML | Cannot be used in XAML. |
| Scripting |
[token = ]downloaderObject.AddEventListener("DownloadProgressChanged", eventhandlerFunction)
|
AddEventListener Parameters
| downloaderObject | object A particular Downloader object. |
| token | integer A token that is returned from the function, which you can optionally retain as a variable. If you intend to call RemoveEventListener to remove the handler, you will need this token. |
| eventhandlerFunction | object The name of your event handler function as it is defined in script. When used as an AddEventListener parameter, quotes around the function name are not required. See Remarks. |
Event Handler Parameters
| sender | object Identifies the object that invoked the event. |
| eventArgs | object This parameter is always set to null. |
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
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
DownloadProgress
Completed