Chapter 5, Advanced Controls
ActivityIndicator
shows that something is happening, whileProgressBar
tells the user what fraction of the task is complete.- The essential difference as far as we are concerned is that events are typically handled in the code-behind, while commands are handled in
ViewModel
. Handling commands inViewModel
is preferable because it makes creating unit tests easier or possible. WeakReferenceManager
is the primary object used in messaging, allowingViewModel
to send notifications toView
or anotherViewModel
without a reference to that object, thus supporting loose coupling.- Styles allow you to create a uniform appearance across instances of controls, centralizing the properties and providing all the advantages of well-factored code.
- One way to refactor styles is to create a base style and then use
BasedOn
to create derived types, adding or overriding properties as needed.