Your Viewmodel contains the state of any data associated with the UI which is not further back in the Model.
Your Viewmodel contains the state of any data associated with the UI which is not further back in the Model. One way I answer questions such as yours is by considering what behaviour I want in the UI and what needs binding to some state information. Or, to put it a different way, any time that I feel like writing some code that would cause UI elements to be shown or hidden, think about how that maps to a boolean variable.So, take large chunks of the UI that only are visible when you have a Model loaded.
These might have their visibility bound to a boolean property in the Viewmodel IsSolutionLoaded. Maybe you want to disable some things if processing is occurring, you could have a property IsCompiling. I've used this approach with a property NotRunningthreadedProcessing as shown below, that let me disable controls when a synchronisation object existed in the Viewmodel.
CNTL_WhiteLevel. SetBinding(ProgressBar. IsEnabledProperty, new Binding("NotRunningThreadedProcessing")); // and the C++/CLI property concerned property bool NotRunningThreadedProcessing { bool get() { return mThreadedCommandSyncher == nullptr; } }.
Thanks for responding! As I read your answer, you would keep the instance of the 'solution'-vm and update the 'solution'-model, thus letting the same instance of the vm respond differently to the gui? – Anders Juul Dec 20 '10 at 11:24 in the end I kept the view model object if I had one and updated the reference to model.
The view model objects implement INotifyPropertyChanged so all I had to do was call PropertyChanged on the bound values. Thanks for helping out! – Anders Juul Dec 20 '10 at 14:16 You're welcome, glad it worked out smoothly for you.
– Andy Dent Dec 22 '10 at 6:32.
In General View Model is the localized version of actualmodel and View is updated whenever there is a change I its viewModel through DataBiding. In your case ,you have 2 states.1- Your View is Loaded 2- Your View is not loaded so should I create a new view model object and let the view bind to the new object? In my thoughts ,YES.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.