Categories
.NET .NET 8 .NET 9 .NET MAUI Android Behaviors Blazor C# Code Commands Desktop Developer General Hybrid iOS Made Easy Mobile MVVM Toolkit Windows Xamarin Xamarin.Forms

Handling UI Events with MVVM Commands in .NET MAUI using EventToCommandBehavior

This article is part of the MVVM – Made Easy series, focusing on handling UI events with ViewModel commands.

This series comprises articles that provide insights into working with the MVVM design pattern, to make it a delightful experience. All the articles in this series can be accessed from here – MVVM – Made Easy

The View serves as the user interface, while the ViewModel is composed of Properties and Commands that encapsulate the underlying logic. This architectural layering offers the distinct advantage of enabling independent development and testing of both components. Data Binding functions as the cohesive element that interlinks these two layers.

An event represents a significant mechanism for notifying state changes, such as a button click, to other components that have a vested interest in the occurrence.

The receiver component is capable of responding to the event by subscribing to it through a method whose signature corresponds with the delegate of the event ensuring type safety. And that method is generally referred to as an event handler.

However, the challenge emerges during the testing of the ViewModel, as the event is closely intertwined with the View. Business logic can’t be independently tested.

Categories
.NET .NET 8 .NET 9 .NET MAUI Android Blazor C# Code Deep Dive Desktop Developer General Hybrid iOS macOS Made Easy Mobile MVVM Visual Studio VS Code Web Windows Xamarin Xamarin.Forms

Using MVVM Toolkit for Messaging in .NET MAUI Blazor Hybrid Apps

This is the third article in the MVVM Made Easy series with a focus on Messaging in .NET MAUI and Blazor Hybrid apps.

Here are the links to other articles in this series.

Although the fundamentals remain the same, the preceding articles were published after the initial version of the MVVM Toolkit, and a lot has transpired since then. An updated article is being prepared and published soon.

Blazor Hybrid represents an exemplary integration of cross-platform .NET MAUI and the Blazor components.

It facilitates the utilization of C# expertise in the development of various applications, including those for Desktop, Mobile, and Web platforms.

However, there are instances when these disparate components must communicate with one another for the integration to function effectively.

Whenever the necessity arises to facilitate communication between loosely coupled components, messaging represents the most effective solution.

Categories
.NET .NET 8 .NET 9 .NET MAUI Blazor C# Code Desktop Developer General Hybrid Mobile MVVM NuGet Quick Fix Windows Windows 10 Windows 11 WinUI 3 Xamarin Xamarin.Forms

CommunityToolkit.Mvvm: Resolving Windows 10 MVVM Project Build Issues

Undoubtedly, CommunityToolkit.Mvvm, aka Microsoft MVVM Toolkit, has recently become one of the most popular NuGet packages among MVVM developers.

It effectively abstracts away the boilerplate code, enabling developers to concentrate exclusively on the task.

However, after the release of package version 8.3 and later, while building the project referencing this Toolkit has encountered failures, accompanied by perplexing error messages like System.TypeInitializationException or Found conflicts between different versions of 'WinRT.Runtime' that could not be resolved. when targeting the Windows 10 platform.