Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon MVVMCross


MVVMCross


MvvmCross is a powerful, opinionated MVVM (Model-View-ViewModel) framework designed for cross-platform application development within the .NET ecosystem. It supports various platforms, including Xamarin.iOS, Xamarin.Android, Xamarin.Forms, Universal Windows Platform (UWP), Windows Presentation Foundation (WPF), and more[1][3][4]. Here's an overview of its key features and how it works:

Key Features of MvvmCross

- MVVM Architecture Pattern: MvvmCross implements the MVVM pattern, which separates the application logic into three interconnected components: Model, View, and ViewModel[3].
- Navigation System: It provides a robust navigation system, allowing for easy management of ViewModel-to-ViewModel transitions[2][4].
- Data Binding: MvvmCross includes a customizable binding engine, enabling developers to create custom bindings for their views[4].
- Inversion of Control (IoC) and Dependency Injection: The framework supports IoC through dependency injection, facilitating loose coupling and testability[3][4].
- Platform-Specific Support: It offers extensive support for platform-specific features and functionalities[3].
- Plugins and Extensions: MvvmCross includes a plugin framework that allows developers to easily integrate additional functionalities like GPS, localization, and more[4].

How MvvmCross Works

Core and UI Projects

MvvmCross applications typically consist of two main parts:

- Core Project: This contains the business logic, ViewModels, services, and models. It is usually implemented as a .NET Standard library to ensure cross-platform compatibility[2].
- UI Projects: Each platform (e.g., iOS, Android) has its own UI project, which includes platform-specific code and views that interact with the Core project[2].

Key Objects and Initialization

- App Class: Located in the Core project, this class is responsible for registering custom objects with the IoC container and initializing the application logic[2].
- AppStart Object: Optional, this object determines which ViewModel to present first during application startup[2].
- Setup Class: Found in each platform project, this class initializes MvvmCross and registers platform-specific services[2].

Initialization Process

1. Platform Startup: The native platform's startup process begins.
2. MvvmCross Setup: The `Setup` class initializes the framework in two steps: `InitializePrimary` (main thread) and `InitializeSecondary` (background thread)[2].
3. App Initialization: The `App` class is initialized, and it provides an `AppStart` object to manage the first navigation step[2].

Getting Started with MvvmCross

To start a new MvvmCross project, developers can use templates like MvxScaffolding. The framework is available via NuGet packages, which should be installed in both the Core and platform-specific projects[3][4]. For detailed guides and documentation, the official MvvmCross website and GitHub repository are excellent resources[1][4].

Citations:
[1] https://www.mvvmcross.com
[2] https://www.mvvmcross.com/documentation/getting-started/mvvmcross-overview
[3] https://www.mvvmcross.com/documentation/getting-started/getting-started
[4] https://github.com/MvvmCross/MvvmCross
[5] https://www.mvvmcross.com/blog/
[6] https://github.com/mvvmcross
[7] https://x.com/mvvmcross?lang=en
[8] https://www.nuget.org/profiles/MvvmCross