Categories
.NET .NET 8 .NET 9 .NET MAUI .NET MAUI 9 Android Blazor C# Code Developer Getting Started Hybrid iOS macOS Mobile NuGet Toolkit Tools Web What's New Windows Xamarin Xamarin.Forms

Integrated App Hosting Builder Method for .NET MAUI Explained

VijayAnand.MauiToolkit is a toolkit that provides various types and methods to make working with .NET MAUI easier. It’s available as a NuGet package and can be installed using the command below.

dotnet add package VijayAnand.MauiToolkit

The latest addition is the Application, Window, and Page integrated app hosting builder extension method.

Introduction:

From .NET MAUI 9, you need to create your main window to run your app by overriding the CreateWindow() method. Instead of setting the Application’s MainPage, pass the page as a parameter to the constructor of the Window type. Alternatively, set its Page property. This topic has already been covered in detail in an earlier article.

Since the app startup configuration is done in one location, MauiProgram.cs, it’s best to set the main Window while configuring the Application in the UseMauiApp() method. Thus the inherited App type acts as a container for global resources. It also handles app events like Start, Sleep, and Resume.

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 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 MAUI Android Blazor C# Desktop Developer Events F# General Hybrid iOS macOS Mobile Standup Video Visual Studio VS Code Web What's New Windows Xamarin Xamarin.Forms

Join the .NET MAUI Community Standup This November

This November, join David, Rachel, and a special guest (probably Stephan Arnas) as they discuss the latest developments in the realm of .NET MAUI during the monthly community standup preceding .NET Conf 2024 next week.

Consult the article titled Getting Started with Syncfusion’s .NET MAUI Toolkit to start using this free and open-source toolkit, with support within the All-in-One MAUI Templates for the initial setup.

The exciting news is that the second set of 5 controls is nearing its release.

  • Button
  • Bottom Sheet
  • Calendar
  • Numeric Entry
  • Numeric Up Down

Remember to join live on Thu, Nov 7 at 18:00 UTCClick the link to access the timing in your local or preferred time zone. Note, that it’s an hour behind its usual schedule.

Update: The community links for this month’s standup will be updated here.

Happy coding. Stay connected as we continue to learn and share the experiences from this exciting journey of being a .NET developer.

Categories
.NET .NET 8 .NET 9 .NET MAUI Android Blazor C# Code Desktop Developer General Hybrid iOS macOS Mobile Web What's New Windows Xamarin Xamarin.Forms

Transitioning from Application’s MainPage to Window’s Page in .NET MAUI 9

This article analyzes a significant change introduced in .NET MAUI 9, specifically the deprecation of the Application’s MainPage property, which has been replaced by the Window’s Page property.

An article has already been published detailing the comprehensive features of .NET MAUI 9.

The MainPage has existed since the inception of Xamarin.Forms, at which time it functioned as a single-window UI framework.

Nevertheless, the design of .NET MAUI incorporates the concept of a Window to effectively support Desktop form factors, including WinUI and Mac Catalyst.

Categories
.NET .NET 8 .NET 9 .NET Conf .NET MAUI Android Blazor C# Desktop Developer Events General Hybrid iOS macOS Mobile Visual Studio VS Code Web Windows Xamarin Xamarin.Forms

Join .NET Conf 2024 Online: Explore .NET 9 Features

November is set to be an exceptionally significant month for .NET developers globally, as a new version of .NET will be officially released during its annual event, .NET Conf. Similar to previous years, this year’s event will also be conducted virtually, allowing participation online. The highly anticipated .NET 9 is scheduled for release during this conference, which will take place over three days from Tue, Nov 12, 2024, to Thu, Nov 14, 2024. Please mark your calendars accordingly.

.NET Conf 2024 - Annual Virtual Developer Event - Release of .NET 9
.NET Conf 2024 – Annual Virtual Developer Event – Release of .NET 9

Quite like .NET 7, .NET 9 is also a short-term support (STS) release, which will be supported for 18 months till mid-May 2026. Even-numbered releases are LTS whereas odd-numbered are STS. More details on the release lifecycle are here. The support for .NET 6 (the previous LTS release) ends (more details here), with .NET 7 already out of support, and .NET 8, the current LTS release, has another 2 years of support till early Nov 2026.

.NET Release Schedule
.NET Release Schedule

Due to the underlying external dependencies, the support policy of .NET MAUI differs significantly from .NET, each major release will be supported only for 18 months. So, if you’re using .NET MAUI 8, support will cease by mid-May 2025 (in another 6 months). Hence, it’s necessary to plan for your app migration to .NET MAUI 9. An article has already been published detailing the comprehensive features of .NET MAUI 9.