Soenneker.Maui.Blazor.Bridge
3.0.24
Prefix Reserved
dotnet add package Soenneker.Maui.Blazor.Bridge --version 3.0.24
NuGet\Install-Package Soenneker.Maui.Blazor.Bridge -Version 3.0.24
<PackageReference Include="Soenneker.Maui.Blazor.Bridge" Version="3.0.24" />
paket add Soenneker.Maui.Blazor.Bridge --version 3.0.24
#r "nuget: Soenneker.Maui.Blazor.Bridge, 3.0.24"
// Install Soenneker.Maui.Blazor.Bridge as a Cake Addin #addin nuget:?package=Soenneker.Maui.Blazor.Bridge&version=3.0.24 // Install Soenneker.Maui.Blazor.Bridge as a Cake Tool #tool nuget:?package=Soenneker.Maui.Blazor.Bridge&version=3.0.24
Soenneker.Maui.Blazor.Bridge
Effortlessly integrate MAUI components within BlazorWebView, enabling seamless interaction between Blazor and native MAUI UI elements.
🚀 Features
✅ Embed MAUI components directly inside BlazorWebView like HTML elements.
✅ Maintain a structured overlay system for native elements.
✅ Provides typed and generic bridges for flexible component integration.
📦 Installation
Install the package via NuGet:
dotnet add package Soenneker.Maui.Blazor.Bridge
Register the interop in CreateMauiApp
:
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.Services.AddMauiBlazorBridgeAsScoped();
}
🛠️ Layout Setup
To integrate MAUI components within BlazorWebView, modify your MainPage.xaml
.
Wrap the BlazorWebView inside a Grid
, and include an AbsoluteLayout (OverlayContainer
) to host native elements:
<Grid>
<BlazorWebView x:Name="blazorWebView"
HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type local:Routes}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
<AbsoluteLayout x:Name="OverlayContainer" BackgroundColor="Transparent" InputTransparent="True" />
</Grid>
This setup ensures that MAUI-native elements overlay correctly within your BlazorWebView.
⚡ Usage
To bridge MAUI elements into Blazor, use either:
MauiBlazorTypedBridge<T>
(Typed binding)MauiBlazorGenericBridge
(Generic binding)
🏗️ Example: Embedding a MauiLabel
in Blazor
@page "/"
@implements IAsyncDisposable
<MauiBlazorTypedBridge @ref="_bridge" TComponent="MauiLabel" Component="_label"></MauiBlazorTypedBridge>
@code {
MauiLabel? _label;
MauiBlazorTypedBridge<MauiLabel>? _bridge;
protected override void OnInitialized()
{
_label = new MauiLabel
{
Text = "This is a MAUI Label",
BackgroundColor = Colors.Transparent,
TextColor = Colors.Black
};
}
public async ValueTask DisposeAsync()
{
if (_bridge != null)
await _bridge.DisposeAsync();
}
}
This example adds a MauiLabel component inside a Blazor page, allowing it to function within the BlazorWebView.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.0
- Microsoft.AspNetCore.Components (>= 9.0.2)
- Microsoft.Maui.Controls (>= 9.0.40)
- Soenneker.Blazor.CallbackRegistry (>= 3.0.31)
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 |
---|---|---|
3.0.24 | 77 | 3/4/2025 |
3.0.23 | 71 | 3/4/2025 |
3.0.22 | 85 | 3/3/2025 |
3.0.21 | 85 | 3/3/2025 |
3.0.20 | 65 | 3/3/2025 |
3.0.19 | 101 | 3/3/2025 |
3.0.18 | 79 | 3/3/2025 |
3.0.17 | 83 | 3/2/2025 |
3.0.15 | 81 | 3/2/2025 |
3.0.14 | 80 | 3/2/2025 |
3.0.13 | 84 | 3/2/2025 |
3.0.12 | 82 | 3/2/2025 |
3.0.11 | 80 | 3/2/2025 |
3.0.10 | 85 | 3/2/2025 |
3.0.9 | 76 | 3/2/2025 |
3.0.8 | 76 | 3/2/2025 |
3.0.7 | 77 | 3/1/2025 |
3.0.6 | 76 | 3/1/2025 |
3.0.5 | 79 | 3/1/2025 |
3.0.4 | 84 | 3/1/2025 |
3.0.3 | 86 | 3/1/2025 |
3.0.2 | 77 | 3/1/2025 |
3.0.1 | 70 | 3/1/2025 |