From kagents
Blazor Hybrid in .NET MAUI — BlazorWebView setup, JavaScript-C# interop (IJSRuntime, JSInvokable), shared Razor Class Libraries, platform-specific DI services, CSS isolation, NavigationManager. USE FOR: embedding Blazor in MAUI apps, sharing UI between MAUI and Blazor Web, implementing JS interop. DO NOT USE FOR: standalone Blazor Server/WASM (use blazor-patterns) or general MAUI views (use maui-patterns).
npx claudepluginhub grexyloco/k.agents --plugin kagentsThis skill uses the workspace's default tool permissions.
Basiert auf: [davidortinau/maui-skills](https://github.com/davidortinau/maui-skills) (MIT, David Ortinau, Microsoft)
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Share bugs, ideas, or general feedback.
Basiert auf: davidortinau/maui-skills (MIT, David Ortinau, Microsoft)
<!-- In .csproj -->
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="..." />
// MauiProgram.cs
builder.Services.AddMauiBlazorWebView();
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
#endif
<!-- In MainPage.xaml -->
<BlazorWebView HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type local:Routes}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
// C# → JavaScript
await JSRuntime.InvokeVoidAsync("showAlert", "Hallo aus C#!");
// JavaScript → C#
[JSInvokable]
public static Task<string> GetDataFromCSharp()
{
return Task.FromResult("Daten aus C#");
}
SharedComponents/
├── SharedComponents.csproj # RCL (Razor Class Library)
├── Pages/
│ ├── Home.razor
│ └── UserList.razor
└── Components/
└── DataGrid.razor
MauiApp/
├── MauiApp.csproj # Referenziert SharedComponents
└── wwwroot/
BlazorWebApp/
├── BlazorWebApp.csproj # Referenziert SharedComponents
└── wwwroot/
// Interface in SharedComponents
public interface IDeviceService { string GetPlatform(); }
// MAUI-Implementierung
public class MauiDeviceService : IDeviceService
{
public string GetPlatform() => DeviceInfo.Platform.ToString();
}
// Web-Implementierung
public class WebDeviceService : IDeviceService
{
public string GetPlatform() => "Web";
}
// DI-Registrierung je nach Host
builder.Services.AddSingleton<IDeviceService, MauiDeviceService>(); // MAUI
builder.Services.AddSingleton<IDeviceService, WebDeviceService>(); // Web
wwwroot/ Ordner muss in MAUI-Projekt existierenNavigationManager unterscheidet sich zwischen MAUI und Web