[dba-VS] Part V: Cross-posted from dba-OT: MVVM explained - looking for English language heavy review/revision, and technical review
Salakhetdinov Shamil
mcp2004 at mail.ru
Sun Sep 6 15:26:59 CDT 2015
(last part - continued from Part IV):
When something is happening with a Model and a Model owned by
a ViewModel is changing its state and is raising a PropertyChanged(...)
event then a ViewModel is deciding what to do:
- to set its internal Model-dependent data structures in correspondence
with the current state of a Model (as a ViewModel is "imagining" a
Model's state to itself);
- to force a Model instance to execute some Commands;
- to raise a PropertyChange events, which eventually could be watched
by a ViewModel's outer world...
A View knows about a ViewModel and "hooks"/subscribes to a few of
PropertyChanged(...) events of this ViewModel. When the latter
is raising a PropertyChanged(...) event hooked by a View then a View is
changing its display area accordingly - according to the
image/representation of a ViewModel, a View is creating for itself
(a View knows nothing about a Model therefore what a View is presenting
on its display area is an approximate representation of a Model
internal state (/rich internal life) and the degree of accuracy
of this representation of a Model internal state on a View display
area is regulated/filtered-by wholly/"deliberately" by a ViewModel.)
A View can also issue Commands against a ViewModel. These Commands
can be just "surface" ones acting on a ViewModel internal state or forcing
a ViewModel to peform some actions, or can be passed by a ViewModel
to a Model, a ViewModel is owning. This is completely a ViewModel's
responsibility to decide how to react on Commands issued by a View.
And so they are living together in this world and even cooperate knowing
little about each other - a Model about anybody and anything, a ViewModel
about a View, and a View about a Model...
Thank you. --
Салахетдинов Шамиль
More information about the dba-VS
mailing list