WPF animation stops when another thread running

前端 未结 2 722
栀梦
栀梦 2021-01-16 04:48

I\'ve a window that shows a \'working\' animation when another thread is running. The window shows and I can see the progress bar but the animation is frozen. The code runs

2条回答
  •  不要未来只要你来
    2021-01-16 05:23

    Your thread does nothing useful - by using _dispatcher.BeginInvoke to run your search you are effectively executing the search on the UI thread, which blocks your animation. Use dispatcher from your background thread only for operations that manipulate UI controls or that cause PropertyChanged events to be fired.

提交回复
热议问题