Silverlight XAML Primer 10, Listing 3

Handling the DownloadProgressChanged event to update a progress bar.

function onDownloadProgressChanged(sender, eventArgs)
{
    var percentComplete = sender.DownloadProgress * 100;
    var progWidth = (sender.FindName("rectProgressBorder").Width / 100);
    sender.FindName("rectProgress").Width = percentComplete * progWidth;         
    sender.FindName("tbProgress").Text = Math.floor(percentComplete) + "%";
}
comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.