在SilverLight4和Windows Phone 7中可以用DispatcherTimer类实现页面倒计时,这个类的命名空间:System.Windows.Threading
int totalSec = 60;
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = new System.TimeSpan(0, 0, 1);
timer.Tick += new EventHandler(timer_CountDown);
timer.Start();
void timer_CountDown(object sender, EventArgs e)
{
if (totalSec > 1)
{
totalSec--;
this.btnSubmit.Content = “倒计时”+totalSec ;
}
else
{
timer.Stop();
}
}