A lightweight MVVM framework for building Blazor WebAssembly and Blazor Server applications.
MvvmBlazor is a small framework that enables developers to build Blazor WebAssembly and Blazor Server applications using the Model-View-ViewModel (MVVM) pattern. It simplifies development by providing automatic bindings, lifecycle management, and seamless integration with Blazor's component model, aiming to increase development speed while minimizing implementation effort.
Developers building Blazor applications who prefer or require the MVVM architectural pattern, particularly those looking to reduce boilerplate code and manage state and UI updates more efficiently.
Developers choose MvvmBlazor for its automatic bindings with re-rendering, source generators that reduce boilerplate, and tight integration with Blazor's dependency injection and lifecycle, offering a streamlined MVVM experience compared to manual implementations.
A lightweight Blazor Mvvm Library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Bindings automatically trigger component re-rendering when view model properties change, eliminating manual StateHasChanged calls, as shown in the ClockViewModel example with @Bind(x => x.DateTime).
Source generators auto-create properties from fields with the [Notify] attribute, cutting down repetitive INotifyPropertyChanged code, though IDE support can be spotty.
View models mirror Blazor component lifecycle methods and handle parameter passing, including type conversion via TypeConverter for strong typing, as detailed in the Parameters section.
View models are registered with Blazor's dependency injection, allowing scoped services like DbContext to be managed with component lifetimes without manual factories.
Source generators may not be recognized by some third-party IDEs, causing false errors and impairing IntelliSense, a limitation openly noted in the README.
Requires .NET 6 or newer, excluding projects on .NET Core 3.1 or .NET 5, which restricts use in legacy or upgrade-resistant environments.
Mandates observable collections and property change notifications, adding complexity for data structures that don't fit this model, and can introduce performance overhead in simple apps.