Prerequisites
- XAML
- Data binding
- Resources
- Commands
- User controls
- Dependency properties
- Behaviors
Design Goals
reuse, extensibility, flexibility, team development, quality
Key Concepts
- Modules: packages of functionality that can be independently developed, tested, and (optionally) deployed.
- Module catalog: used to specify which modules to are to be loaded, when they are loaded, and in what order.
- Shell: is the host application into which modules are loaded(defines the overall layout and structure).
- View(UI controls)
- View models and presenters: encapsulate the application's presentation logic and state.
- Models: encapsulate the application data and business logic.
- Commands: DelegateCommand and CompositeCommand.
- Regions: logical placeholders defined within the application's UI (in the shell or within views) into which views are displayed. Such as ContentControl, ItemsControl, ListBox, or TabControl.
- Navigation
- EventAggregator
- Dependency injection container
- Services
- Controllers
- Bootstrapper
- Multi-targeting
Module
Lifetime
- Registering via code or XMAL.
- Discovering in a folder, configuration or downloaded assemblies.
- Loading from disk
- Initializing: register types with container, show UI and so on.
Communicate Between Modules
- Loosely coupled events
- Shared services
- Shared resources
MVVM
Model
- encapsulate the application's data and business logic
- do not directly reference the view or view model classes and have no dependency on how they are implemented.
View
- is Control-derived or UserControl-derived classed.
- data templates can be thought of as views that do not have any code-behind.
- the view references the view model through its DataContext property.
- ...
View Model
- encapsulates the presentation logic required to support a use case or user task in the application.
- notifies the view of any state changes via change notification events via the INotifyPropertyChanged and INotifyCollectionChanged interfaces.
- implement data validation via the IDataErrorInfo or INotifyDataErrorInfo interfaces.
- may define logical states that the view can represent visually to the user.
Class Interactions
- Data Binding
- implements INotifyPropertyChanged and RaisePropertyChanged
- ObservableCollection
- ICollectionView and ListCollectionView
- Commands
- ICommand
- ActionCommand(provided by BLENK), DelegateCommand(provided by Prism)
- CompositeCommand
- Data Validation and Error Reporting
- ValidatesOnExceptions = true
- IDataErrorInfo or INotifyDataErrorInfo
Construction and Wire-Up
- creating the view model using XAML
- creating the view model programmatically
- creating a view defined as a data template
Other
- IActiveAware
- Handling asynchronous interactions
Compositing the User Interface
Regions
- RegionManager provides RegionContext to shared data between regions.
- RegionAdapter is responsible for creating a region and associating it with the control.
- Region Behavior is a class that is attached to a region to give additional functionality
- Registration Behavior
- Auto-Population Behavior
- Region Context Behavior
- Activation Behavior
- Control-Specific Behavior
View Composition
- View Discovery
- View Injection
UI Layout
- Implementing Shell
- Defining Regions
- Displaying Views in a Region When the Region Loads
- Creating Views
- User Controls: custom controls, data templates.
- Resources: application, module, control.