Making sure OnPropertyChanged() is called on UI thread in MVVM WPF app

前端 未结 5 2080
执念已碎
执念已碎 2020-11-28 07:15

In a WPF app that I\'m writing using the MVVM pattern, I have a background process that doing it\'s thing, but need to get status updates from it out to the UI.

I\'m

5条回答
  •  爱一瞬间的悲伤
    2020-11-28 07:33

    I REALLY like Jeremy's answer: Dispatching In Silverlight

    Summary:

    • Placing Dispatcher in ViewModel seems inelegant

    • Creating an Action property, set it to just run the action in the VM constructor

    • When using the VM from the V, set the Action property to invoke the Dispatcher

提交回复
热议问题