Documente Academic
Documente Profesional
Documente Cultură
Model-View-ViewModel (MVVM)
Its a separation pattern, like MVC or MVP Improves structure / separation of concerns Enables better designer / developer workflow Enhances testability Made possible by the robust data binding capabilities of Silverlight and WPF
MVVM Structure
View
XAML Data bindings
View Model
Model of the View (or View of the Model)
Model
Domain model / business logic
Services, persistence, everything else
the view binds to ViewModel implements INotifyPropertyChanged to relay change notifications to View The Views DataContext is bound to the ViewModel, making all of its properties and commands available to the entire View
Model and exposes relevant portions of it to the View ViewModel calls services to fetch or save data to the Model
ICommand
Execute CanExecute CanExecuteChanged event
MVVM Basics
DEMO
DEMO
DEMO
DEMO
New UpdateSourceTrigger
Adds PropertyChanged option to available UpdateSourceTriggers also from WPF When used, the source of the binding (on our ViewModel) is updated whenever the property on the View is changed
PropertyChanged UpdateSourceTrigger
DEMO
They provide a value one that is often not known until runtime Silverlight 5 now allows us to create our own markup extensions
DEMO
DEMO
Text improvements
Character spacing and line height TextOptions pixel snapping OpenType support Linked text blocks for multi-column and flowing text
Linked text
RichTextBlocks can now specify a RichTextBlockOverflow element that text will flow to when full RichTextBlockOverflow elements can specify additional overflow containers Limited only to read-only RichTextBlocks
DEMO
TextOptions
TextFormattingMode
Ideal, Display (pixel snapping)
TextHintingMode
Fixed, Animated
TextRenderingMode
Auto, Aliased, Greyscale, ClearType
OpenType Support
Ligatures glyphs with more than one letter Contextual Alternates Stylistic Sets Variants superscript and subscript Fractions Much more in the Typography class!
DEMO
Learn More!
This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details!