Categories
.NET .NET 10 .NET 9 .NET MAUI .NET MAUI 10 Android Blazor C# Deep Dive Desktop Developer Getting Started Hybrid iOS macOS Mobile What's New What's New Windows Xamarin Xamarin.Forms XAML

What’s New in .NET MAUI 10: Global and Implicit Namespaces for XAML

.NET MAUI 10 is the fifth major release of .NET MAUI, a cross-platform framework for building mobile and desktop apps.

It’s slated for a GA release during the .NET Conf, an annual virtual developer event, scheduled from Nov 11-13, 2025.

It’s packed with many quality of life improvements. The Global and Implicit Namespace for XAML feature is the pick of the lot.

To learn about the key features of .NET MAUI 10, check out this Overview article.

Categories
.NET .NET 10 ASP.NET Core Aspire Automation Azure Blazor C# CLI Code Desktop Developer Getting Started Linux macOS Mobile Visual Studio VS Code Web What's New Windows

Using C# Ignored Directives: A Guide for Programmers

C# – Preprocessor Directives are highly useful for writing code that can be compiled conditionally, depending on factors like the target framework, target platform, or build configuration.

For example:

#if NET9_0_OR_GREATER
// The code within this block will execute only on .NET 9 or higher
#endif

#if ANDROID
// The code within this block will execute only on the Android OS
#endif

#if DEBUG
// The code within this block will execute only in Debug mode
#endif

C# – Ignored Directives have a similar syntax but are ignored by the compiler because they are for tooling.

The real purpose of this feature is to execute a C# source file directly from the CLI. It doesn’t need a project file. Now, even the plain console app requires a project file, despite the much-simplified top-level statements feature.

Categories
.NET .NET 10 .NET MAUI Android Blazor C# Code Deep Dive Desktop Developer Getting Started Hybrid iOS Learn Mobile Preview Visual Studio VS Code Web What's New Windows Xamarin Xamarin.Forms

What’s New in C# 14 – Extension Members – A Comprehensive Guide

Introduced in C# 3.0, extension methods are a valuable feature for external types, especially when those types are sealed, such as string.

Roughly two decades later, C# has now finally unveiled support for extending everything.

With the release of .NET 10 Preview 3 (C# 14), it is now possible to define static methods, instance properties, and static properties too. Support for other members will be incorporated in future releases.

Syntactically, an extension method should be defined within a top-level static class. The type of its first mandatory parameter, the one qualified with the this keyword, determines the type being extended. Henceforth, this will be referred to as the receiver type.

All standard query operators of LINQ are defined as extension methods. They are defined in the Enumerable static class within the BCL (in the System.Linq namespace).

For example, the Where extension method applies to all types that implement IEnumerable<T>. Validations and optimizations aside, the typical implementation is as outlined below.

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 9 .NET MAUI C# Code Desktop Developer Getting Started Hybrid macOS MVVM What's New Windows Xamarin Xamarin.Forms

What’s New in .NET MAUI 9 – Window TitleBar

Window TitleBar is one of the two prominent enhancements in .NET MAUI 9, the recently released major version of the cross-platform App UI framework.

The other new feature is HybridWebView, consult this article titled Exploring .NET MAUI 9 – HybridWebView to delve into the details of this new control.

An article that comprehensively outlines the significant features of this version has already been published and is accessible here.

The Window type defines two properties – Page and TitleBar.

Page:

In .NET MAUI 9, the MainPage property of the Application class is now obsolete, replaced by the Page property of the Window class to accommodate this new TitleBar feature for the Desktop (Windows and Mac Catalyst). To know more about this MainPage change, refer to this article.

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# Desktop Developer Extensions General Getting Started Hybrid iOS JavaScript macOS Mobile NuGet Templates Tools Visual Studio VS Code Web What's New Windows Xamarin Xamarin.Forms

.NET MAUI 9: Introducing the HybridWebView Project Template

HybridWebView is one of the two prominent enhancements in .NET MAUI 9, the recently released major version of the cross-platform App UI framework.

An article that comprehensively outlines the significant features of this version has already been published and is accessible here.

Consult this article titled Exploring .NET MAUI 9 – HybridWebView to delve into the details of this new control.

Nonetheless, the components that constitute the HybridWebView project must be assembled manually, as there is no inherent template available akin to that of Blazor Hybrid. So, it is appropriate to include one in the .NET MAUI All-in-One Templates pack. As the name suggests, has a slew of features under the hood to work with .NET MAUI, consult the articles linked here to know more about them.

Glad to introduce a new project template using HybridWebView in the templates pack v6.1. This article will describe how to install and utilize this new project template.

Categories
.NET .NET 8 .NET 9 .NET Conf .NET MAUI Android Blazor C# Desktop Developer General Getting Started Hybrid iOS macOS Mobile Preview Tools Video Visual Studio VS Code Web What's New Windows Xamarin Xamarin.Forms

.NET MAUI – Enable Debugger-Detached XAML Live Preview in Visual Studio 2022

Not confined to .NET MAUI, the XAML Live Preview functions as an invaluable tool for inspecting the UI and its associated properties in XAML apps overall.

However, it is imperative that the app be connected to the debugger, is it not? Yes, that is prior to the intro of the debugger-detached XAML Live Preview in VS2022, v17.13 Preview 1.0.

Yesterday, during the .NET MAUI session at .NET Conf 2024 (YouTube clip linked), David and Rachel provided an insightful overview of its functionality.

To know about this virtual event, consult this .NET Conf 2024 article and this detailed article outlining the comprehensive features of .NET MAUI 9.

Categories
.NET .NET 8 .NET 9 .NET MAUI Android Blazor C# Code Desktop Developer General Getting Started Hybrid iOS macOS Made Easy MVVM NuGet Preview Toolkit Visual Studio VS Code What's New Windows Xamarin Xamarin.Forms

MVVM Toolkit v8.4: Custom Access Modifiers for Partial Properties – How To

This article is part of the MVVM – Made Easy series, with a focus on the initial preview release of v8.4 of the CommunityToolkit.Mvvm (aka Microsoft MVVM Toolkit) NuGet package, which includes support for Partial Properties.

Update as of Dec 2024: The v8.4 stable release is now available. For further details, please refer to this blog post.

Here are the links to other articles in this series.

Support for Partial Properties is one of most sought after features in the MVVM toolkit as it allows to define custom access modifier for property accessors and makes code more readable. The need for an analyzer to track the usage of a field instead of a (generated) property is no longer necessary.