TextBlock.Text = DateTime.Now.ToString(); 不能用TextBlock吧
---->  textBlock1.Text = DateTime.Now.ToString();

解决方案 »

  1.   

    谢谢你,这个不影响,我是将TextBlock 命名为了 TextBlock,所以这个是没有问题的,如果我这样写
    private void TextBlock_Loaded(object sender, RoutedEventArgs e)
            {                timers = new DispatcherTimer();
                timers.Interval = new TimeSpan(0, 0, 0, 1);
              //  timers.Tick += new EventHandler(timers_Tick);        -------------->这里有问题
                timers.Start();
               timers_Tick();                                   ———————>直接调用是能够显示日期时间的,就是无法自动更新
            }
           void timers_Tick(object sender,EventArgs e)
           {
                TextBlock.Text = DateTime.Now.ToString();
                
            }
      

  2.   

    pricate DispatcherTimer timers=null;