FmgLib.MauiMarkup Documentation
FmgLib.MauiMarkup is a fluent C# markup library for .NET MAUI. It lets you build your entire user interface in pure C# — no XAML required — using readable, chainable extension methods that are automatically generated for every bindable property and event of every MAUI control.
C# Copy
new Label ()
.Text ("Hello, FmgLib!" )
.FontSize (30 )
.TextColor (Colors .Green )
.Center ()
This documentation is a complete, self-contained guide to the library. Every topic from the project README is covered here in much greater depth, together with usage patterns discovered directly from the library source code.
Table of Contents#
1. Fundamentals#
Document
What you will learn
Getting Started
Installation, project templates, first app, project structure
From XAML to C#
How XAML concepts map to FmgLib.MauiMarkup, side-by-side conversions
Fluent Properties
The four overload patterns, theme/platform/idiom-aware values, dynamic resources
Object References (Assign)
Assign, InvokeOnElement, RegisterName, referencing controls without fields
2. Data Binding#
Document
What you will learn
Property Bindings
Path, Source, BindingMode, StringFormat, fallback values, the low-level Bind() API
Binding Converters
Inline Convert/ConvertBack, IValueConverter, func-based converters
MultiBinding
Combining several bindings into one property, IMultiValueConverter
Compiled Bindings
Getter/Setter expression bindings, Binding.Create, performance
3. Layout#
Document
What you will learn
Layout Options
Alignment and fill helpers (Center, AlignTopLeft, FillHorizontal, …)
Grid
Row/column definition builders (Star, Auto, Absolute), positioning children
Text Alignment
ITextAlignment helpers (TextCenter, TextTopLeft, …)
Attached Properties
Full mapping table and examples for Grid, Shell, Semantic, Automation, …
4. Interaction#
Document
What you will learn
Event Handlers
On<EventName> methods, method groups vs. inline lambdas
Gesture Recognizers
Tap, pan, pointer, swipe, pinch, drag & drop
Behaviors
Attaching reusable behaviors, writing custom behaviors
Triggers
Property, data, event, multi and state triggers
Menus
Context menus (MenuFlyout), menu bars, keyboard accelerators
SwipeView
Swipe-to-action rows, SwipeItems, custom swipe content
5. Appearance#
Document
What you will learn
Styling
Style<T>, resource dictionaries, BasedOn, derived types, app-wide themes
Visual States
VisualState<T>, built-in state names, state-driven animations
Gradients & Brushes
Linear/radial gradients, solid brushes, shadows
Shapes & Geometries
Lines, rectangles, ellipses, polygons, Path geometries, clipping
Formatted Text
FormattedString/Span, mixed styling, tappable inline links
Animations
Generated Animate…To helpers, MAUI animation interop
6. Application Architecture#
Document
What you will learn
Shell Applications
Building a Shell in C#, flyouts, tabs, templates, navigation
Application & Windows
Application setup, window lifecycle, TitleBar, NavigationPage/TabbedPage/FlyoutPage
Hot Reload
IFmgLibHotReload, FmgLibContentPage, MVVM page bases
Collections & Templates
CollectionView, ItemTemplate overloads, BindableLayout, EmptyView
Localization (JSON)
JSON-file based localization, runtime language switching
Localization (RESX)
RESX-based localization with TranslatorResx
7. Extensibility & Reference#
Document
What you will learn
Third-Party Controls
[MauiMarkup], [MauiMarkupAttachedProp], automatic generator mode
Custom Extension Methods
Writing your own fluent methods that work everywhere
Utilities
ToColor, collection helpers, AddRangeMarkup, style interop
Complete Examples
Full pages: login screen, product list, settings page, MVVM patterns
Tips & Troubleshooting
Common pitfalls, naming rules, FAQ
🇹🇷 Bu dokümantasyonun Türkçe sürümü tr/ klasöründedir.
Suggested Learning Path#
New to the library? Read Getting Started , then From XAML to C# and Fluent Properties . These three explain 80% of everyday usage.
Building real pages? Continue with Layout Options , Grid , Property Bindings and Hot Reload .
Polishing an app? Styling , Visual States , Triggers and Animations .
Shipping to multiple markets? Localization (JSON) or Localization (RESX) .
Using SkiaSharp, ZXing, UraniumUI, InputKit…? Third-Party Controls .
Package Overview#
Core Idea in 30 Seconds#
Every bindable property of every MAUI control gets a fluent extension method with the same name as the property . Every event gets an On<EventName> method . All methods return the control itself, so calls chain naturally and the nesting of your C# code mirrors the visual tree — just like XAML, but with full IntelliSense, refactoring, compile-time safety, and no context switching between two languages.
C# Copy
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 ()
)
);
}