Posts

Showing posts with the label CSharp

5 Modern Alternatives to MessagingCenter in .NET MAUI 9

Image
Join our exclusive WhatsApp group for Xamarin and .NET MAUI developers to connect with experts, share insights, and get help with your projects. Whether you're a beginner or an experienced developer, this group is the perfect place to enhance your skills and collaborate with the community. Sending Messages in .NET MAUI 9 — Modern Alternatives to MessagingCenter Short summary: MessagingCenter was handy in Xamarin.Forms for broadcast-style communication across pages/viewmodels/services. In .NET MAUI (.NET 9) you should use modern, safer, and more testable approaches. This post covers five alternatives. For each option we’ll walk step-by-step: diagram → code (string & class) → detailed explanation. 1. WeakReferenceMessenger (CommunityToolkit.Mvvm) — Recommended Sender → Messenger → Receiver (weak references used by messenger) String Message Example // Send WeakReferenceMessenger.Default.Send("Hello from Page A"); // Receive WeakReferenceMessenger....

What's New in .NET MAUI for .NET 9: Exploring the New Controls

Image
The latest .NET MAUI 9 introduces two new exciting controls: HybridWebView and Titlebar for Windows. Let's explore these controls and how you can integrate them into your applications. HybridWebView The HybridWebView control allows you to host HTML, JavaScript, and CSS content in a web view, enabling communication between the code in the web view (JavaScript) and the hosting code (C#/.NET). For example, you can host an existing React JS app in a .NET MAUI native app and build the backend using C# and .NET. To create a .NET MAUI app using HybridWebView, you need: Static web content (HTML, JS, CSS, etc.) The HybridWebView control as part of the app UI (referenced in XAML) Code in both the web content and the C#/.NET side to send messages between components For more information, refer to the official HybridWebView documentation . Titlebar for Windows The Titlebar control a...