Downloader class is restricted to accessing data in the same domain.
This document will concentrate on using the
Downloader object. See Using YUI and Silverlight 1.0 for an example of fetching XML data.
Downloader object has been modeled after XMLHttpRequest and is very similar in use and limitations. The main difference is the ability to load other
types of content and not just XML. It can also download ZIP packages and provides access to the archived files.
Downloader provides progress information which is useful when downloading large files.
The main uses are:
Downloader object with packages of assets makes sense when you have multiple items that are required for your application to run. Combining them
into a single download will enhance the performance by eliminating unnecessary network calls. You can use the progress information to provide users with feedback during the download
and improve the perceived performance as well.
The examples on this page assume that references to various objects have been saved as properties on the current class.
Downloader class has three events that will give you progress information about the download
and let you provide status updates to the user and also an event when the downloaded content is ready to be accessed.
Downloading individual files and ZIP packages happens in a similar manner. The following example shows downloading a ZIP file, but downloading individual files is accomplished simply by substituting the filename.
MediaElement objects allow you to set the source either directly from a URL using the
or from assets retrieved using the
Downloader object using the
XAML documents and fragments can also be downloaded from packages. XAML tends to be verbose and can often quickly grow very long especially with graphics and animations. Luckily XAML is plain text and compresses well and thus makes an ideal item to look at when optimizing Silverlight applications.
Related information on the web is listed below.