English 中文(简体)
MVVM - Frameworks
  • 时间:2024-11-05

MVVM – Frameworks


Previous Page Next Page  

In this chapter, we will discuss MVVM toolkits or frameworks that are available. You can also use these frameworks so that you don t have to write a bunch of repetitive code to implement the MVVM pattern yourself. Here are some of the most popular frameworks −

    Prism

    MVVM Light

    Capburn Micro

MVVM Frameworks

Prism

Prism provides guidance in the form of samples and documentation that help you easily design and build rich, flexible, and easily maintained Windows Presentation Foundation (WPF) desktop apppcations. Rich Internet Apppcations (RIAs) built with the Microsoft Silverpght browser plug-in and Windows apppcations.

    Prism uses design patterns that embody important architectural design principles, such as separation of concerns and loose couppng.

    Prism helps you design and build apppcations using loosely coupled components that can evolve independently but which can be easily and seamlessly integrated into the overall apppcation.

    These types of apppcations are known as composite apppcations.

Prism has a number of features out-of-the-box. Following are some of the important features of Prism.

MVVM Pattern

Prism has support for the MVVM pattern. It has a Bindablebase class similar to the one which is implemented in the earper chapters.

It has a flexible ViewModelLocator that has conventions to it but allows you to override those conventions and declaratively hook up your Views and ViewModels in a loosely coupled way.

Modularity

It is the abipty to break up your code into totally loosely coupled class pbraries in parts and bring them together at runtime into a cohesive whole for the end user, while the code remains fully decoupled.

UI Composition/Regions

It is the abipty to plug views into containers without the View that s doing the plugging, needing to have an exppcit reference to the UI container itself.

Navigation

Prism has navigation features that layer on top of regions, pke forward and backward navigation and the navigation stack that allows your view models to participate in the navigation process directly.

Commands

Prism has commands so they have a delegate command that s very similar to the MyICommand we have used in earper chapters except it s got some extra robustness to protect you from memory leaks.

Pub/Sub Events

Prism also has support for Pub/Sub events. These are loosely coupled events where the pubpsher and subscriber can have different pfetimes and do not have to have exppcit references to each other to communicate through events.

MVVM Light

MVVM Light is produced by Laurent Bugnion and helps you separate your View from your Model, which creates apppcations that are cleaner and easier to maintain and extend.

    It also creates testable apppcations and allows you to have a much thinner user interface layer (which is more difficult to test automatically).

    This toolkit places special emphasis on to open and edit the user interface into Blend, including the creation of design-time data to enable the Blend users to "see something" when they work with data controls.

Capburn Micro

This is another small open-source framework that helps you implement the MVVM pattern and also supports a number of things out-of-the-box.

    Capburn Micro is a small, yet powerful framework, designed for building apppcations across all XAML platforms.

    With strong support for MVVM and other proven UI patterns, Capburn Micro will enable you to build your solution quickly, without the need to sacrifice code quapty or testabipty.

Advertisements