Home Web Front-end Front-end Q&A What are the mvvm frameworks?

What are the mvvm frameworks?

Nov 09, 2020 am 11:02 AM
mvvm frame

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 of this Website
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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to evaluate the cost-effectiveness of commercial support for Java frameworks How to evaluate the cost-effectiveness of commercial support for Java frameworks Jun 05, 2024 pm 05:25 PM

Evaluating the cost/performance of commercial support for a Java framework involves the following steps: Determine the required level of assurance and service level agreement (SLA) guarantees. The experience and expertise of the research support team. Consider additional services such as upgrades, troubleshooting, and performance optimization. Weigh business support costs against risk mitigation and increased efficiency.

How does the learning curve of PHP frameworks compare to other language frameworks? How does the learning curve of PHP frameworks compare to other language frameworks? Jun 06, 2024 pm 12:41 PM

The learning curve of a PHP framework depends on language proficiency, framework complexity, documentation quality, and community support. The learning curve of PHP frameworks is higher when compared to Python frameworks and lower when compared to Ruby frameworks. Compared to Java frameworks, PHP frameworks have a moderate learning curve but a shorter time to get started.

How do the lightweight options of PHP frameworks affect application performance? How do the lightweight options of PHP frameworks affect application performance? Jun 06, 2024 am 10:53 AM

The lightweight PHP framework improves application performance through small size and low resource consumption. Its features include: small size, fast startup, low memory usage, improved response speed and throughput, and reduced resource consumption. Practical case: SlimFramework creates REST API, only 500KB, high responsiveness and high throughput

Performance comparison of Java frameworks Performance comparison of Java frameworks Jun 04, 2024 pm 03:56 PM

According to benchmarks, for small, high-performance applications, Quarkus (fast startup, low memory) or Micronaut (TechEmpower excellent) are ideal choices. SpringBoot is suitable for large, full-stack applications, but has slightly slower startup times and memory usage.

Golang framework documentation best practices Golang framework documentation best practices Jun 04, 2024 pm 05:00 PM

Writing clear and comprehensive documentation is crucial for the Golang framework. Best practices include following an established documentation style, such as Google's Go Coding Style Guide. Use a clear organizational structure, including headings, subheadings, and lists, and provide navigation. Provides comprehensive and accurate information, including getting started guides, API references, and concepts. Use code examples to illustrate concepts and usage. Keep documentation updated, track changes and document new features. Provide support and community resources such as GitHub issues and forums. Create practical examples, such as API documentation.

How to choose the best golang framework for different application scenarios How to choose the best golang framework for different application scenarios Jun 05, 2024 pm 04:05 PM

Choose the best Go framework based on application scenarios: consider application type, language features, performance requirements, and ecosystem. Common Go frameworks: Gin (Web application), Echo (Web service), Fiber (high throughput), gorm (ORM), fasthttp (speed). Practical case: building REST API (Fiber) and interacting with the database (gorm). Choose a framework: choose fasthttp for key performance, Gin/Echo for flexible web applications, and gorm for database interaction.

What are the common misunderstandings in the learning process of Golang framework? What are the common misunderstandings in the learning process of Golang framework? Jun 05, 2024 pm 09:59 PM

There are five misunderstandings in Go framework learning: over-reliance on the framework and limited flexibility. If you don’t follow the framework conventions, the code will be difficult to maintain. Using outdated libraries can cause security and compatibility issues. Excessive use of packages obfuscates code structure. Ignoring error handling leads to unexpected behavior and crashes.

Detailed practical explanation of golang framework development: Questions and Answers Detailed practical explanation of golang framework development: Questions and Answers Jun 06, 2024 am 10:57 AM

In Go framework development, common challenges and their solutions are: Error handling: Use the errors package for management, and use middleware to centrally handle errors. Authentication and authorization: Integrate third-party libraries and create custom middleware to check credentials. Concurrency processing: Use goroutines, mutexes, and channels to control resource access. Unit testing: Use gotest packages, mocks, and stubs for isolation, and code coverage tools to ensure sufficiency. Deployment and monitoring: Use Docker containers to package deployments, set up data backups, and track performance and errors with logging and monitoring tools.

See all articles