Timer callback closes WPF app (DispatcherTimer works..)
问题 I have a WPF app with a textblock that displays the current time. Said textblock is bound to a DependencyProperty on the ViewModel. Naturally I need to keep updating the time, so I used a timer (System.Threading.Timer) like so: public MainViewModel() { _dateTimer = new Timer(_dateTimer_Tick, null, 0, 60000); } void _dateTimer_Tick(object sender) { Time = DateTime.Now.ToString("HH:mm"); Date = DateTime.Now.ToString("D"); } The thing is, when the callback is called, the app exits... bummer