search
HomeWeb Front-endFront-end Q&AWhat are the mvvm frameworks?

What are the mvvm frameworks?

Nov 09, 2020 am 11:02 AM
mvvmframe

The mvvm framework includes: 1. MVVMLight framework, a lightweight framework that implements the MVVM pattern; 2. Prism framework; 3. Caliburn framework, an open source framework for MVVM classes; 4. MVVM Helpers framework; 5. Cinch framework; 6. MVVM Foundation framework

What are the mvvm frameworks?

##The framework to implement MVVM

1. The most powerful and versatile composition framework - Prism

Download address: http://compositewpf.codeplex.com/

Developer: Microsoft patterns & practices team

Whether Silverlight is supported: Yes

Learning materials: Composite Application Guidance for WPF and Silverlight - May 2010.chm and Quickstarts and StockTraderRI, etc.

Source code screenshots are as follows:

What are the mvvm frameworks?##Prism——previously called Composite Application Guidance for WPF and Silverlight, it is a complex enterprise-level application based on WPF/Silverlight Mainstream application framework. There are several important concepts in Prism:

1. BootStrapper: The application entry point, inherits Prism's UnityContainer or the MefUnityContainer provided by MEF, and provides a container for the system.

2, Shell: It is a shell that layouts pages through UI elements and Regions. It is the top-level window of the application, and the displayed content is generally filled by View. The Shell itself does not know what content it contains, so the functions are specifically provided by each Module.

3, View: It is equivalent to View in MVP mode and MVVM mode. It can be injected into Region through IRegionManager.

4, Module: A large project can be split into parts. Each Module contains View, data, and model, and is mainly used to implement complex business operations.

5, IModuleManager: mainly used to manage module loading and can achieve dynamic loading.

6, IEventAggregator: event processing interface, implementing subscription and publishing modes, which is also the general practice of MVVM framework.

Prism is a relatively large combination framework. It has become more powerful after the introduction of MEF and functional adjustments in 4.0. Now it can be said to be the unity of the combination framework and application framework, and it is the strength of the Microsoft team, so I chose It's worth guaranteeing.


2. The most powerful and versatile application framework - Caliburn

Download address: http://caliburn.codeplex.com/

Developer: Rob Eisenberg

Does Silverlight support: Yes

Learning materials: I mainly refer to project examples, source code, unit test cases, and some foreign blogs and communities.

Source code screenshots are as follows:

What are the mvvm frameworks?There are several important concepts in Caliburn:

1, Commands based on Actions There are many features, including multiple parameters, filter operations, and asynchronous calls.

2. The life cycle events of forms and controls are also handled relatively well (including activation, deactivation, shutdown, etc.).

3. The testability of both the entire framework and applications based on this framework is relatively good.

4, provides many common functions, which are more useful in projects.

5, in addition to supporting the MVVM mode, it also supports the MVP mode and other variant modes.

6, powerful dependency injection framework and AOP framework, you can flexibly choose one of them here.

Caliburn is a very powerful MVVM application framework that provides flexible and diverse implementations of many functions. Whether it is project use or code research, I feel that it has benefited a lot.

3. Lightweight and applicable MVVMLight

MVVMLight is a lightweight framework that implements the MVVM pattern (relative to Prism), which can better help us Develop WPF, Windows Phone, Windows 8, SilverLight related projects.

Laurent Bugnion, the author of MVVMLight, is a Microsoft MVP. The author open sourced the code to Codeplex: http://mvvmlight.codeplex.com/.

MVVMLight’s official website: http://www.mvvmlight.net/, which has detailed introduction and video documents. If you are interested, you can learn more.

Download address: http://mvvmlight.codeplex.com/

Developer: Laurent Bugnion

Support Silverlight: Yes

Learning materials: In addition to online documentation, I mainly refer to project examples, source code, unit test cases, and some foreign blogs and communities. In addition, these three articles are very good. I developed a relatively complete Silverlight enterprise project using MVVMLight

    Part 1 - Introduction, Installation, and General Application Design Topics
  • Part 2 - MVVM Light Topics
  • Part 3 - Custom Authentication, Reset Password and User Maintenance
  • The source code screenshot is as follows:

What are the mvvm frameworks?There are several important concepts in MVVMLight:

1, RelayCommand: By encapsulating Command, the MVVM mode is easier to use on WPF and Silverlight. You only need to define each RelayCommand in the ViewModel, and then use the Command to bind the RelayCommand defined in the ViewModel in the View to achieve the same effects as WinForm and ASP.NET events, but here the UI and logic are removed strong coupling.

2, Messager: The Messager in MVVMLight plays a relatively large role. As mentioned earlier, the MVVM mode removes the strong references of ViewModel and View, so how do they interact? It is used to allow ViewModel and View to communicate. Generally, we will define a static AppMessages class as a general communication class. The principle is the publish-subscribe model.

3, EventToCommand: This is similar to the concept of additional behavior, which was introduced in MVVM Light Toolkit V3.

4, ICleanup interface: When displaying a View, you need to first call the Cleanup method to clear the data. This is also some necessary operations due to the coupling isolation of ViewModel and View.

MVVMLight is a very easy-to-use MVVM framework that provides templates and intelligent sensing for VS and Blend. It feels really lightweight and efficient when used in combination with MEF, and it provides support for WPF and Silverlight, especially Silverlight support, so generally choose the lightweight Silverlight MVVM mode, which is more promising.

4. Full-featured and easy-to-use MVVM Helpers

Download address: http://mvvmhelpers.codeplex.com/

Developer: Mark Smith

Whether to support Silverlight: No

Learning materials: http://www.julmar.com/blog/mark/ and the provided examples, source code and test cases.

The source code screenshot is as follows:

What are the mvvm frameworks?

##MVVM Helpers is also called JulMar MVVM Helpers Behaviors, which has several important concepts:

1 , provides the basic functions of the MVVM model, including the isolation between ViewModel, View and Model, and also provides some common functions.

2. The creation of ViewModel is injected in the form of tags, and MEF can also be introduced now.

3. IOC/DI support, attributes have verification mechanisms, and Wait Cursor support can be released in time after the viewmodel is used, thus avoiding memory leaks.

4. Provides support for commonly used Attached Behaviors.

5. The introduction of message mechanism to avoid coupling caused by strong references.

MVVM Helpers is a very applicable MVVM framework, especially it provides the common MVVM functions MEF Attached Behaviors, so the problems in the project can basically be solved.

5, powerful and lightweight Cinch

Download address: http://cinch.codeplex.com/

Developer: Sacha Barber

Whether Silverlight is supported: No

Learning materials: http://sachabarber.net/ and provided examples, source code and test cases.

The screenshot of the source code is as follows:

What are the mvvm frameworks?

If you study the code carefully, you will find that it has a lot of similar code to the MVVM Helpers mentioned above, and they are probably related to each other. I made a reference :-D. There are several important concepts in Cinch:

1. This framework has already implemented strong reference isolation between ViewModel and View before MEF appeared. It has neither general IOC configuration nor IView. It is used for transfer, and the life cycle events of forms and controls are also handled relatively well, so it is very good in this regard.

2, provides support for commonly used Attached Behaviors, and also provides some common MVVM functions.

3, DI/IOC is implemented using Unity and multi-threaded to avoid unpredictable errors in the system.

4. When the viewmodel is used, it can be released in time to avoid memory leaks. The verification mechanism is added and common navigation is implemented.

5, the introduction of message mechanism to avoid coupling caused by strong references.

Cinch is a very powerful framework, especially because it focuses on the construction of the entire application, so it is also more popular.

6. MVVMFoundation with simple functions and easy expansion

Download address: http://mvvmfoundation.codeplex.com/

Developer: Josh Smith

Whether it supports Silverlight: No

Learning materials: http://joshsmithonwpf.wordpress.com/ and the provided examples, source code and test cases.

Source code screenshots are as follows:

What are the mvvm frameworks?

There are several important concepts in MVVM Foundation:

1, Messenger: This is mainly used in various Communication between different ViewModels (such as interrelated ViewModels, master-slave ViewModels, etc.), of course, can also be extended to communication between ViewModel and View.

2, ObservableObject: This is equivalent to the concept of ViewModelBase. Each ViewModel inherits from this class and is released immediately after the call is completed to prevent memory leaks.

3, PropertyObserver: Mainly encapsulates INotifyPropertyChanged.PropertyChanged, so that encapsulation can simplify the code and prevent memory leaks caused by improper operations.

4, RelayCommand interface: encapsulates the command statement, including execution execution logic, optional can-execute logic, etc. Externally, you only need to instantiate and Binding to use it easily.

MVVMFoundation is a very simple MVVM framework. If you find it difficult to study the source code, you can start with this framework first. The code is simple and refined.

For more programming-related knowledge, please visit: Programming Learning Website! !

The above is the detailed content of What are the mvvm frameworks?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML and React's Integration: A Practical GuideHTML and React's Integration: A Practical GuideApr 21, 2025 am 12:16 AM

HTML and React can be seamlessly integrated through JSX to build an efficient user interface. 1) Embed HTML elements using JSX, 2) Optimize rendering performance using virtual DOM, 3) Manage and render HTML structures through componentization. This integration method is not only intuitive, but also improves application performance.

React and HTML: Rendering Data and Handling EventsReact and HTML: Rendering Data and Handling EventsApr 20, 2025 am 12:21 AM

React efficiently renders data through state and props, and handles user events through the synthesis event system. 1) Use useState to manage state, such as the counter example. 2) Event processing is implemented by adding functions in JSX, such as button clicks. 3) The key attribute is required to render the list, such as the TodoList component. 4) For form processing, useState and e.preventDefault(), such as Form components.

The Backend Connection: How React Interacts with ServersThe Backend Connection: How React Interacts with ServersApr 20, 2025 am 12:19 AM

React interacts with the server through HTTP requests to obtain, send, update and delete data. 1) User operation triggers events, 2) Initiate HTTP requests, 3) Process server responses, 4) Update component status and re-render.

React: Focusing on the User Interface (Frontend)React: Focusing on the User Interface (Frontend)Apr 20, 2025 am 12:18 AM

React is a JavaScript library for building user interfaces that improves efficiency through component development and virtual DOM. 1. Components and JSX: Use JSX syntax to define components to enhance code intuitiveness and quality. 2. Virtual DOM and Rendering: Optimize rendering performance through virtual DOM and diff algorithms. 3. State management and Hooks: Hooks such as useState and useEffect simplify state management and side effects handling. 4. Example of usage: From basic forms to advanced global state management, use the ContextAPI. 5. Common errors and debugging: Avoid improper state management and component update problems, and use ReactDevTools to debug. 6. Performance optimization and optimality

React's Role: Frontend or Backend? Clarifying the DistinctionReact's Role: Frontend or Backend? Clarifying the DistinctionApr 20, 2025 am 12:15 AM

Reactisafrontendlibrary,focusedonbuildinguserinterfaces.ItmanagesUIstateandupdatesefficientlyusingavirtualDOM,andinteractswithbackendservicesviaAPIsfordatahandling,butdoesnotprocessorstoredataitself.

React in the HTML: Building Interactive User InterfacesReact in the HTML: Building Interactive User InterfacesApr 20, 2025 am 12:05 AM

React can be embedded in HTML to enhance or completely rewrite traditional HTML pages. 1) The basic steps to using React include adding a root div in HTML and rendering the React component via ReactDOM.render(). 2) More advanced applications include using useState to manage state and implement complex UI interactions such as counters and to-do lists. 3) Optimization and best practices include code segmentation, lazy loading and using React.memo and useMemo to improve performance. Through these methods, developers can leverage the power of React to build dynamic and responsive user interfaces.

React: The Foundation for Modern Frontend DevelopmentReact: The Foundation for Modern Frontend DevelopmentApr 19, 2025 am 12:23 AM

React is a JavaScript library for building modern front-end applications. 1. It uses componentized and virtual DOM to optimize performance. 2. Components use JSX to define, state and attributes to manage data. 3. Hooks simplify life cycle management. 4. Use ContextAPI to manage global status. 5. Common errors require debugging status updates and life cycles. 6. Optimization techniques include Memoization, code splitting and virtual scrolling.

The Future of React: Trends and Innovations in Web DevelopmentThe Future of React: Trends and Innovations in Web DevelopmentApr 19, 2025 am 12:22 AM

React's future will focus on the ultimate in component development, performance optimization and deep integration with other technology stacks. 1) React will further simplify the creation and management of components and promote the ultimate in component development. 2) Performance optimization will become the focus, especially in large applications. 3) React will be deeply integrated with technologies such as GraphQL and TypeScript to improve the development experience.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software