Condividi tramite


OnSourceDownloadProgressChanged (Silverlight Plug-in Object)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the name of the event handler that is called when the source download progress changes.

Syntax

object Element

<object ...>
  <param name="onsourcedownloadprogresschanged" value="functionname"/>
  ...
</object>

Silverlight.js

Not implemented in the functions.

JavaScript

Do not use; use the object parameter as the handler attachment point.

COM

IXcpControl::OnSourceDownloadProgressChanged

Managed Code

Not available.

Property Value

The name of the function that is invoked when the source download progress changes. The default value is null.

Remarks

You can handle this event in order to report download progress in a splash screen or in the hosting HTML page.

The event reports progress for the package that has been requested through the Source property. The event that reports download progress is raised at intervals that are determined internally based on the size and the time of the download. The event is not raised as soon a particular percentage increment is downloaded. For short downloads, the event might be raised only a few times. For long downloads, the event might be raised thousands of times.

The most typical scenario for tracking download progress is to display the progress information to the user in a splash screen. The splash-screen XAML page must always use the JavaScript API. Any JavaScript code for the splash screen (including event handlers that are referenced by this property) must be made in a script block or in an included script file that is referenced from the hosting HTML page. You cannot provide a value for OnSourceDownloadProgressChanged from managed code, and there is no scenario for doing so, because by the time the managed runtime is initialized, all occurrences of the event are in the past.

If you are referencing a Source that is cross-domain from the hosting HTML, handlers for OnSourceDownloadComplete or OnSourceDownloadProgressChanged are never invoked. Therefore you can only display indeterminate splash screens if loading source cross-domain. The hosting HTML may wish to assign a handler for OnLoad in this case, as it is the best available object lifetime event for resetting state after the source XAP loads.

For more information about how to work with splash screens, see Silverlight Splash Screens.

Arguments for an OnSourceDownloadProgressChanged Function

sender

object

The Silverlight plug-in that raised the event.

downloadProgressEventArgs

object

An object that contains information about download progress. The Progress property of this object contains a number between 0 and 1, which indicates how much of the document has been downloaded.