Silverlight Primer 9, Listing 2

Handling the Silverlight Downloader object's events to display progress and access downloaded content.

function onProgressChanged(sender, eventArgs)
{
   var percentComplete = Math.floor(sender.DownloadProgress * 100);
   sender.FindName("tbProgress").Text = percentComplete + "%";
}

function onCompleted(sender, eventArgs)
{
  var control = sender.GetHost();
  var root = control.Content.Root;

  // Load XAML from inside the .zip file
  var buttonsCanvas = control.Content.CreateFromXamlDownloader(
    sender, "Buttons.xaml");
  buttonsCanvas["Canvas.Top"] = "350";
  //Add downloaded content into main canvas
  root.Children.Add(buttonsCanvas);
}
comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.