Refresh UI with a Timer in WPF (with BackgroundWorker?)

前端 未结 2 929
半阙折子戏
半阙折子戏 2021-01-04 12:33

We have an application in WPF that shows data via ObservableCollection. After 5 minutes, I want to refresh the data.

I thought I could use the System.Timers.Ti

2条回答
  •  既然无缘
    2021-01-04 12:42

    This answer explains the problem with using the Timer vs DispatcherTimer when updating the UI. https://stackoverflow.com/a/2258909/1698182

    I have not tried this but for periodic work items that will use a thread do the bulk of the work this looks like it will do the trick. http://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj248676.aspx

提交回复
热议问题