I have a View that is hooked to a ViewModel. I have a singleton class that's exposed by foo.Current. I have a property on that class that will be changing as the result of a button click command calling a foo.Current function. I want to be able to bind a textbox's text to that value and when that value updates the textbox will update. My ViewModel does implement INotifyPropertyChanged and I have other properties on the view model that update controls fine. What is the best way I can make that singleton class update my ViewModel with the new value? I'm thinking I need to figure out a way to make the Singleton class update the ViewModel.
There's no "best" way in current situation, options are as follows:
Easiest one would be the first option though there might be some architectural inconsistencies in your app that should be treated.
如果我理解你,我会使用Observer模式。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.