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

  1. Registering via code or XMAL.
  2. Discovering in a folder, configuration or downloaded assemblies.
  3. Loading from disk
  4. 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
    1. implements INotifyPropertyChanged and RaisePropertyChanged
    2. ObservableCollection
    3. ICollectionView and ListCollectionView
  • Commands
    1. ICommand
    2. ActionCommand(provided by BLENK), DelegateCommand(provided by Prism)
    3. CompositeCommand
  • Data Validation and Error Reporting
    1. ValidatesOnExceptions = true
    2. 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
    1. Registration Behavior
    2. Auto-Population Behavior
    3. Region Context Behavior
    4. Activation Behavior
    5. 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
    1. User Controls: custom controls, data templates.
    2. Resources: application, module, control.

Last edited Nov 25, 2013 at 9:02 AM by e1evenli, version 5