Orientation="Vertical" Background="White" > FontFamily="Time New Romain" FontSize="16" FontWeight="Bold" > The operation progress Foreground="Cyan" Background="AntiqueWhite" BorderBrush="Blue" Maximum="100" Width="200" Height="20" Margin="15" /> Margin="15,15" >
using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;using System.Collections.ObjectModel;namespace Silverlight2{ public partial class Page : UserControl { ProgressBar oBar; Storyboard oTimer; TextBlock Result; public Page() { InitializeComponent(); InitializeBehaviour(); } public void InitializeBehaviour() { oBar = this.FindName("myBar") as ProgressBar; oTimer = new Storyboard(); Result = this.FindName("myTextBloc") as TextBlock; oTimer.Duration = new Duration(new TimeSpan(10)); oTimer.Completed+=new EventHandler(oTimer_Completed); oTimer.Begin(); } Random x = new Random(); public void oTimer_Completed(object sender, EventArgs e) { int period = x.Next(1, 5)*100; if (oBar.Value < oBar.Maximum) { System.Threading.Thread.CurrentThread.Join(period); oBar.Value += 1; oTimer.Begin(); } if (oBar.Value >= oBar.Maximum) Result.Text = "Operation accomplished"; } }}