Silverlight Primer 9, Listing 1

Using the Silverlight Downloader object to download files from within a Silverlight application.

 function CreateSilverlight()
      source: "Default.xaml",
      parentElement: document.getElementById("divSilverlight"),
      id: "slControl",
      properties: { 
        width: "400", 
        height: "400", 
        version: "1.0" 
      events: { 
   onLoad: onLoad, 
   onError: null 

function onLoad(control, context, rootElement)
  var downloader = control.CreateObject("downloader");
  //Attach to Downloader object events
  downloader.AddEventListener("Completed", onCompleted);
  // Avoid caching by adding date on end of querystring
  downloader.Open("GET", "" + new Date()); 
comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.