This " User Control" has an " Image", which will be displayed in the web browser.
![silverlight download file stream silverlight download file stream](https://www.c-sharpcorner.com/UploadFile/dbd951/how-to-read-and-write-files-in-silverlight-4/Images/ReWriFileSil2.gif)
In order to make sure the on-demand downloading process of the " XapContent.xap" file is always visible in the browser, caching is disabled by changing the " " file:
#SILVERLIGHT DOWNLOAD FILE STREAM CODE#
The Silverlight "XAP" file " XapLoader.xap" is hosted in the " Default.aspx" file:Ĭopy Code Silverlight Download on Demand Example The host web applicationĪs you can see from the picture, "XapWebHost" is a simple ASP.NET web application. Let us first take a look at the "XapWebHost" web project.
#SILVERLIGHT DOWNLOAD FILE STREAM INSTALL#
You need to download and install " Silverlight 4 SDK" and " Silverlight 4". If you want to download the source code and run it in your own Visual Studio, you will need to have your development environment set up. The " XapContent.xap" file is the "XAP" package to be downloaded on demand in this article.Īfter successful compilation, Visual Studio will put both " XapLoader.xap" and " XapContent.xap" into the " ClientBin" folder in the "XapWebHost" project. It will generate a "XAP" file called " XapContent.xap".
![silverlight download file stream silverlight download file stream](http://cespage.com/silverlight/tutorials/sl4newapp.png)
But separating the resources into different "XAP" files can potentially provide some advantages in some other cases: In many cases, putting the resources into a single "XAP" file should be the correct choice. They can also choose to put these resources into separate "XAP" packages and let the browsers download them as needed. When developing a Silverlight application, developers can put all the " User Controls" and other resources in a single "XAP" package. To run a Silverlight application, browsers need to download the "XAP" packages generated by the Silverlight projects.
![silverlight download file stream silverlight download file stream](https://i.ytimg.com/vi/FEGRyGZwaRI/maxresdefault.jpg)
This article introduces a method to download and use "XAP" packages on demand in Silverlight.