WPF/Multithreading: UI Dispatcher in MVVM

前端 未结 7 1369
有刺的猬
有刺的猬 2020-12-24 09:49

So say in an MVVM environment, I\'m in a background thread and I\'d like to run an update on a ui control. So normally I\'d go myButton.Dispatcher.BeginInvoke(blabla) but I

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-24 10:20

    I usually use Application.Current.Dispatcher: since Application.Current is static, you don't need a reference to a control

提交回复
热议问题