XamarinBridge.Maui 0.1.0

dotnet add package XamarinBridge.Maui --version 0.1.0
                    
NuGet\Install-Package XamarinBridge.Maui -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XamarinBridge.Maui" Version="0.1.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XamarinBridge.Maui" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="XamarinBridge.Maui">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XamarinBridge.Maui --version 0.1.0
                    
#r "nuget: XamarinBridge.Maui, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XamarinBridge.Maui@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XamarinBridge.Maui&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=XamarinBridge.Maui&version=0.1.0
                    
Install as a Cake Tool

XamarinBridge.Maui

Accelerate your Xamarin.Forms to .NET MAUI migration with Roslyn analyzers, code fixers, and drop-in runtime compatibility shims.

Packages

Package Description Type
XamarinBridge.Maui Roslyn analyzers + code fixers Dev dependency (free)
XamarinBridge.Compat Runtime compatibility shims Runtime dependency

Quick Start

1. Install the analyzer (catches migration issues at build time)

dotnet add package XamarinBridge.Maui

2. Install the runtime compat shims (drop-in replacements)

dotnet add package XamarinBridge.Compat

3. Register in MauiProgram.cs

using XamarinBridge.Compat;

var builder = MauiApp.CreateBuilder();
builder.UseXamarinCompat();

Analyzers (XamarinBridge.Maui)

ID Description Auto-Fix
XB001 using Xamarin.FormsMicrosoft.Maui.Controls Yes
XB002 using Xamarin.Essentials → specific Microsoft.Maui.* namespaces Yes
XB003 [ExportRenderer] → handler registration TODO Yes
XB006 Device.RuntimePlatformDeviceInfo.Platform Yes

Runtime Shims (XamarinBridge.Compat)

DependencyService

Drop-in for Xamarin.Forms.DependencyService. Routes to MAUI DI when available.

using XamarinBridge.Compat;

// Register (same API as Xamarin.Forms)
DependencyService.Register<IMyService, MyServiceImpl>();

// Resolve — checks internal registry, then falls back to MAUI DI
var svc = DependencyService.Get<IMyService>();
var transient = DependencyService.Get<IMyService>(DependencyFetchTarget.NewInstance);

MessagingCenter

Drop-in for Xamarin.Forms.MessagingCenter. Backed by WeakReferenceMessenger.

using XamarinBridge.Compat;

// Subscribe
MessagingCenter.Subscribe<MainPage>(this, "Refresh", sender => { /* ... */ });

// Send
MessagingCenter.Send(this, "Refresh");

// With args
MessagingCenter.Subscribe<MainPage, string>(this, "Navigate", (sender, route) => { /* ... */ });
MessagingCenter.Send(this, "Navigate", "/details/42");

// Unsubscribe
MessagingCenter.Unsubscribe<MainPage>(this, "Refresh");

Device

Drop-in for Xamarin.Forms.Device. Routes to MAUI DeviceInfo/MainThread.

using XamarinBridge.Compat;

// Platform detection
if (Device.RuntimePlatform == Device.iOS) { /* ... */ }

// Idiom
if (Device.Idiom == TargetIdiom.Tablet) { /* ... */ }

// Main thread
Device.BeginInvokeOnMainThread(() => label.Text = "Updated");
await Device.InvokeOnMainThreadAsync(() => DoWork());

// Timer
Device.StartTimer(TimeSpan.FromSeconds(5), () => { Refresh(); return true; });

ApplicationProperties

Drop-in for Application.Current.Properties. Backed by MAUI Preferences.

using XamarinBridge.Compat;

var props = ApplicationProperties.Current;
props["username"] = "michael";
props["loginCount"] = 42;

var name = (string)props["username"];
await props.SaveAsync(); // No-op — auto-persists

OnPlatform

Concise platform branching in code-behind.

using XamarinBridge.Compat;

var fontSize = OnPlatform.Get(ios: 14.0, android: 16.0, defaultValue: 15.0);
var margin = OnPlatform.Get(ios: 20, android: 16, winui: 24, defaultValue: 16);

ColorConverter

Bridges Xamarin.Forms color patterns to MAUI Colors.

using XamarinBridge.Compat;

var red = ColorConverter.FromHex("#FF0000");
var blue = ColorConverter.FromRgb(0, 0, 255);
var semiTransparent = ColorConverter.FromRgba(1.0, 0.0, 0.0, 0.5);
var green = "#00FF00".ToMauiColor();

EffectCompat

Base class for migrating Xamarin.Forms Effects to MAUI PlatformBehaviors.

using XamarinBridge.Compat;

// Before (Xamarin.Forms):
// public class ShadowEffect : RoutingEffect { ... }

// After (MAUI with XamarinBridge):
public class ShadowEffect : EffectCompat<View>
{
    protected override void OnAttached(View element) { /* add shadow */ }
    protected override void OnDetached(View element) { /* remove shadow */ }
}

MigratedRendererAttribute

Documentation attribute to track renderer → handler migration progress.

using XamarinBridge.Compat;

[MigratedRenderer(typeof(CustomEntry), Notes = "Converted to handler pattern 2024-03")]
public class CustomEntryHandler : ViewHandler<CustomEntry, UITextField> { }

Roadmap

  • XB004 - OnElementChanged → handler mapper pattern
  • XB005 - DependencyService.Get<T>() → constructor injection
  • XB007 - Effects → PlatformBehavior scaffold
  • XB009 - MessagingCenterWeakReferenceMessenger
  • Navigation stack compatibility (INavigation → Shell bridge)
  • CLI migration scanner (solution-wide analysis + report)

License

MIT

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 96 5/4/2026