FmgLib.MauiMarkup

August 15, 2026 · View on GitHub

NuGet PackageLinkRepo Info
FmgLib.MauiMarkupNuGet NuGet DownloadsGitHub Stars GitHub Forks GitHub last-commit
FmgLib.MauiMarkup.TemplateNuGet NuGet Downloads-

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:

TopicStart here
Setup, first page, project structureGetting Started
Translating any XAML to fluent C#From XAML to C#
Property methods, OnLight/OnDark, OnPlatform, OnIdiom, DynamicResourceFluent Properties
Bindings, converters, multi-binding, compiled bindingsProperty Bindings
Layout helpers, Grid builders, attached propertiesLayout Options · Grid · Attached Properties
Events, gestures, behaviors, triggers, menus, SwipeViewEvent Handlers · Triggers
Style<T>, visual states, gradients, shapes, animationsStyling · Visual States
Shell apps, windows, collections & templatesShell Applications
Hot reload (IDE support matrix, dotnet watch dev loop, troubleshooting)Hot Reload
JSON / RESX localization with live language switchingLocalization
Third-party controls ([MauiMarkup], auto-generation, Syncfusion/UraniumUI/…)Third-Party Controls
Full example pages & common pitfallsComplete Examples · Tips & Troubleshooting
AI Skills — teach your coding agent this libraryAI 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, call InitializeHotReload(), and your Build() re-runs on every code edit (leak-free, crash-isolated, works with dotnet watch and IDE hot reload).
  • First-class bindings — string paths or compiled Getter expressions, inline converters, typed multi-bindings (Path/Getter several times + MultiConvert), FallbackValue/TargetNullValue.
  • ThemingOnLight/OnDark, OnPlatform, OnIdiom, DynamicResource on any property; strongly-typed Style<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.