MvvmAIO.Markup.Avalonia
0.2.0
See the version list below for details.
dotnet add package MvvmAIO.Markup.Avalonia --version 0.2.0
NuGet\Install-Package MvvmAIO.Markup.Avalonia -Version 0.2.0
<PackageReference Include="MvvmAIO.Markup.Avalonia" Version="0.2.0" />
<PackageVersion Include="MvvmAIO.Markup.Avalonia" Version="0.2.0" />
<PackageReference Include="MvvmAIO.Markup.Avalonia" />
paket add MvvmAIO.Markup.Avalonia --version 0.2.0
#r "nuget: MvvmAIO.Markup.Avalonia, 0.2.0"
#:package MvvmAIO.Markup.Avalonia@0.2.0
#addin nuget:?package=MvvmAIO.Markup.Avalonia&version=0.2.0
#tool nuget:?package=MvvmAIO.Markup.Avalonia&version=0.2.0
MvvmAIO.Markup
XAML markup extensions for common CLR types (booleans, integers, Guid, DateTime, TimeSpan, decimal, double, enum, and more). The shared implementation ships in two NuGet packages: WPF and Avalonia.
Packages
| Package | Description |
|---|---|
MvvmAIO.Markup.WPF |
WPF (UseWPF), multi-targeted from .NET Framework 4.6.1 through .NET 10 (Windows). |
MvvmAIO.Markup.Avalonia |
Avalonia 12, .NET 8 / 10. |
Authors: MvvmAIO, Skymly, wys0610. License: MIT.
Installation
dotnet add package MvvmAIO.Markup.WPF
# or
dotnet add package MvvmAIO.Markup.Avalonia
Usage (WPF / Avalonia)
The library maps MvvmAIO.Markup into the default XAML namespace via XmlnsDefinition.
- WPF: use the built-in
xprefix with the extension type name (for example{x:Int32 42},{x:True}). - Avalonia: the
xprefix can resolve to CLR primitives (System.Int32, etc.) before custom extensions. Declarexmlns:m="using:MvvmAIO.Markup"and use{m:Int32 42},{m:True}, and so on. Built-in{x:Null}and{x:Type …}stay onx.
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Sample">
<Button Content="Demo"
CommandParameter="{x:Int32 42}"
ToolTip="{x:Boolean True}" />
</Window>
Markup extensions
| Extension | WPF | Avalonia | Notes |
|---|---|---|---|
Boolean |
✓ | ✓ | {x:Boolean True} — constructor argument required |
True |
✓ | ✓ | {x:True} — parameterless |
False |
✓ | ✓ | {x:False} — parameterless |
SByte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64 |
✓ | ✓ | Integer literals |
Single, Double, Decimal |
✓ | ✓ | Floating-point literals |
Char |
✓ | ✓ | Single character |
Guid |
✓ | ✓ | |
DateTime, TimeSpan |
✓ | ✓ | Invariant culture parsing |
String |
✓ | ✓ | |
Uri |
✓ | ✓ | Quote values with commas or special characters |
CultureInfo |
✓ | ✓ | e.g. {x:CultureInfo 'zh-CN'} |
Enum |
✓ | ✓ | {x:Enum {x:Type MyEnum},member} — case-insensitive |
Thickness |
✓ | ✓ | String constructor, e.g. {x:Thickness 8} |
Point, Size, Rect, Vector |
✓ | ✓ | Comma-separated — quote the value |
GridLength, CornerRadius |
✓ | ✓ |
Null and booleans
| Syntax | When to use |
|---|---|
{x:Null} |
Null reference for CommandParameter, attached properties, etc. (built-in XAML; not provided by this library). |
{x:True} / {x:False} |
Shorthand bool literals without a constructor argument. |
{x:Boolean True} |
Same CLR value as {x:True}, when you need the explicit Boolean extension form. |
This library does not ship Nullable*Extension types — use {x:Null} for null.
Quoted constructor arguments
Values that contain commas (or other characters that break XAML tokenization) must be a single quoted argument:
CommandParameter="{x:Point '10,20'}"
CommandParameter="{x:Uri 'pack://application:,,,/Images/logo.png'}"
See Samples.WPF ({x:…}) and Samples.Avalonia (xmlns:m + {m:…}) for full button matrices.
Building & packing
- Solution:
MvvmAIO.Markup.slnx - Pack both NuGet packages:
dotnet pack MvvmAIO.Markup.Pack/MvvmAIO.Markup.Pack.csproj -c Release - Nuke (CI parity):
dotnet run --project build/_build.csproj -- --target Ci --configuration Release
Contributing
Automated agents and contributors: see AGENTS.md (中文摘要), CONTRIBUTING.md, and CHANGELOG.md.
Repository
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.