本文共 392 字,大约阅读时间需要 1 分钟。
前台定义一个 TextBolck
<TextBox x:Name="tb1" Text="{Binding TextProperty1, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
后台:
private DispatcherTimer timer;
IntialLoad()
{
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += new EventHandler(timer_Tick); timer.Start();}
void timer_Tick(object sender, EventArgs e)
{ TextProperty1 = DateTime.Now.ToString(); }转载地址:http://vviii.baihongyu.com/