Home > other >  WPF DispatcherTimer used problem
WPF DispatcherTimer used problem

Time:09-19

When I was in use DispatcherTimer set the time interval of 20 ms but occasionally there will be a delay 500 ms to execute to the Tick method, don't know what reason be? Everybody have a similar situation?

CodePudding user response:

How do you know the 500 ms delay?

CodePudding user response:

Because of waiting for the UI thread free.
DispatcherTimer unlike other Timer, I'll do as you want to run on the UI thread, if the interface element is complex, the UI thread to refresh the task is more, will be unstable, need to wait for the UI thread free to continue to do.
  • Related