Categories
.NET .NET 8 .NET 9 .NET MAUI Android Blazor C# Code Desktop Developer Getting Started Hybrid iOS macOS Mobile MVVM Windows Xamarin Xamarin.Forms XAML

XAML Basics: Building UI with .NET MAUI and More – Part 2

This article represents the second installment of the XAML for Beginners series, which elucidates the concept of declarative markup in the context of defining UI in .NET applications. All articles within this series are accessible from here.

The initial article focused mainly on introducing XAML and its building blocks.

In this article, the focus will be on the following:

  • Attached Properties
  • Generics
  • Passing Arguments
Categories
.NET .NET 8 .NET 9 .NET MAUI Android Blazor C# Desktop Developer Getting Started Hybrid iOS Mobile MVVM Windows XAML

XAML Basics: Building UI with .NET MAUI and More

Starting a new series entitled XAML for Beginners elucidates the concept of declarative markup to define UI in .NET applications. All articles within this series can be accessed from here.

The second installment of this series is now available to read here.

XAML is an acronym that stands for eXtensible Application Markup Language. It was first introduced in 2006, accompanying the initial release of Windows Presentation Foundation (WPF) alongside .NET 3.0.

The principal objective of this methodology is to segregate the UI design from the program logic. This separation allows the design team to focus solely on the UI, while the program logic can be developed and evaluated independently. Consequently, these components can be integrated into a unified system.

The MVVM design pattern is an exemplary framework for accomplishing this. However, XAML also supports the code-behind approach.

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.