FmgLib.MauiMarkup
August 15, 2026 · View on GitHub
| NuGet Package | Link | Repo Info |
|---|---|---|
FmgLib.MauiMarkup | ||
FmgLib.MauiMarkup.Template | - |
FmgLib.MauiMarkup is a fluent C# markup library for .NET MAUI: build your entire UI in pure C# — no XAML. Every bindable property of every MAUI control gets a chainable extension method with the same name, and every event gets an On<EventName> method, so your code reads like the visual tree while keeping full IntelliSense, refactoring and compile-time safety.
public partial class MainPage : ContentPage, IFmgLibHotReload
{
int count = 0;
public MainPage() => this.InitializeHotReload();
public void Build() =>
this.Content(
new VerticalStackLayout()
.Spacing(25)
.Padding(30)
.Center()
.Children(
new Image()
.Source("dotnet_bot.png")
.HeightRequest(200)
.CenterHorizontal(),
new Label()
.Text("Hello, World!")
.FontSize(32)
.CenterHorizontal(),
new Button()
.Text("Click me")
.OnClicked(b => b.Text = $"Clicked {++count} times")
.CenterHorizontal()
)
);
}
Quick Start
New project (recommended — ships hot-reload tasks, no XAML pages):
dotnet new install FmgLib.MauiMarkup.Template
dotnet new fmglib-mauimarkup-app -o MyApp
Optional parameters: --netMajor 10|9 (default 10), --includeContent true|false (default false, adds sample pages).
Existing MAUI project:
dotnet add package FmgLib.MauiMarkup
The package targets .NET 10 (MAUI 10) and .NET 9 (MAUI 9), so the same version works for both.
No registration call needed — the fluent methods and the source generator come with the package. XAML and FmgLib pages coexist, so you can migrate incrementally.
📚 Documentation
The complete documentation lives in docs/ — every feature with detailed explanations and examples. Highlights:
| Topic | Start here |
|---|---|
| Setup, first page, project structure | Getting Started |
| Translating any XAML to fluent C# | From XAML to C# |
Property methods, OnLight/OnDark, OnPlatform, OnIdiom, DynamicResource | Fluent Properties |
| Bindings, converters, multi-binding, compiled bindings | Property Bindings |
Layout helpers, Grid builders, attached properties | Layout Options · Grid · Attached Properties |
Events, gestures, behaviors, triggers, menus, SwipeView | Event Handlers · Triggers |
Style<T>, visual states, gradients, shapes, animations | Styling · Visual States |
| Shell apps, windows, collections & templates | Shell Applications |
Hot reload (IDE support matrix, dotnet watch dev loop, troubleshooting) | Hot Reload |
| JSON / RESX localization with live language switching | Localization |
Third-party controls ([MauiMarkup], auto-generation, Syncfusion/UraniumUI/…) | Third-Party Controls |
| Full example pages & common pitfalls | Complete Examples · Tips & Troubleshooting |
| AI Skills — teach your coding agent this library | AI Skills · skills/ |
🇹🇷 Dokümantasyonun Türkçe sürümü: docs/tr/
🤖 AI Skills
Ten installable skill bundles teach AI coding agents (Claude Code, the Claude apps, the Agent SDK, or anything that reads a SKILL.md) how to write correct FmgLib.MauiMarkup — the naming rules they can derive instead of guess, the Build() lifecycle, the binding builder, the source generator, and the mistakes that fail silently.
Fetch https://fmglibmauimarkup.vodisoft.com/llms.txt and install the FmgLib.MauiMarkup AI skills.
Or copy any folder from skills/ into ~/.claude/skills/ (personal) or <repo>/.claude/skills/ (shared with your team). Full catalog and manual install: AI Skills.
Key Features
- Every control, every property, every event — fluent methods generated for the whole MAUI surface, always in sync with the referenced MAUI version.
- Third-party controls too — annotate with
[MauiMarkup(typeof(...))]or set<MauiMarkupSourceGenerator>true</MauiMarkupSourceGenerator>and the source generator produces the same fluent API for Syncfusion, UraniumUI, SkiaSharp, ZXing, DevExpress, InputKit… - Hot reload built in — implement
IFmgLibHotReload, callInitializeHotReload(), and yourBuild()re-runs on every code edit (leak-free, crash-isolated, works withdotnet watchand IDE hot reload). - First-class bindings — string paths or compiled
Getterexpressions, inline converters, typed multi-bindings (Path/Getterseveral times +MultiConvert),FallbackValue/TargetNullValue. - Theming —
OnLight/OnDark,OnPlatform,OnIdiom,DynamicResourceon any property; strongly-typedStyle<T>with triggers and visual states. - Localization — JSON or RESX based, with instant runtime language switching.
Samples
The sample/ folder contains complete applications: a 2048 game, an F1 TV browser, an order app, third-party integration demos and more.
License
See LICENSE.
Third-party notices
Certain core property-building and styling components were originally based on Sharp.UI and have since been developed for FmgLib.MauiMarkup. The applicable MIT notice is included in THIRD-PARTY-NOTICES.