MvvmAIO.Markup.WPF 0.3.1

dotnet add package MvvmAIO.Markup.WPF --version 0.3.1
                    
NuGet\Install-Package MvvmAIO.Markup.WPF -Version 0.3.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MvvmAIO.Markup.WPF" Version="0.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MvvmAIO.Markup.WPF" Version="0.3.1" />
                    
Directory.Packages.props
<PackageReference Include="MvvmAIO.Markup.WPF" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MvvmAIO.Markup.WPF --version 0.3.1
                    
#r "nuget: MvvmAIO.Markup.WPF, 0.3.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MvvmAIO.Markup.WPF@0.3.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MvvmAIO.Markup.WPF&version=0.3.1
                    
Install as a Cake Addin
#tool nuget:?package=MvvmAIO.Markup.WPF&version=0.3.1
                    
Install as a Cake Tool

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 on xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml".

WPF

Use {x:…} markup extensions for all supported types (for example {x:Int32 42}, {x:True}, {x:Thickness 8}).

<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>

Avalonia

Avalonia resolves CLR primitive names in the x namespace before custom {x:Int32 …} markup extensions. Use two patterns (both use the x prefix):

Kind Syntax Example
Built-in {x:True}, {x:False}, {x:Null}, {x:Type …} CommandParameter="{x:True}"
Platform extensions (this library) {x:…} markup CommandParameter="{x:Thickness 8}"
Shared CLR literals Object elements (<x:Int32>…</x:Int32>, etc.) See below
Enum / CultureInfo x:EnumExtension / x:CultureInfoExtension with x:Arguments See Samples.Avalonia
<Button Command="{Binding MyCommand}"
        CommandParameter="{x:Thickness 8}" />
<Button Command="{Binding MyCommand}">
  <Button.CommandParameter>
    <x:Int32>42</x:Int32>
  </Button.CommandParameter>
</Button>

Prefer Avalonia built-in {x:True} / {x:False} over {x:Boolean …} in attribute form.

Markup extensions

Extension WPF Avalonia Notes
Boolean WPF: {x:Boolean True}; Avalonia: <x:Boolean>True</x:Boolean> or built-in {x:True}
True WPF: {x:True}; Avalonia: prefer built-in {x:True}
False WPF: {x:False}; Avalonia: prefer built-in {x:False}
SByte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64 WPF: {x:Int32 n}; Avalonia: <x:Int32>n</x:Int32>
Single, Double, Decimal WPF: {x:…}; Avalonia: <x:…> object element
Char
Guid
DateTime, TimeSpan Invariant culture parsing
String
Uri Quote comma values in WPF {x:Uri '…'}
CultureInfo WPF: {x:CultureInfo 'zh-CN'}; Avalonia: x:CultureInfoExtension + x:Arguments
Enum WPF: {x:Enum {x:Type T},member}; Avalonia: x:EnumExtension + x:Arguments
Thickness {x:Thickness 8} (both platforms)
Point, Size, Rect, Vector Comma-separated — quote the value
GridLength, CornerRadius
Color {x:Color '#FFFF0000'}
Duration, KeyTime WPF animation (System.Windows)

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 and Samples.Avalonia for full button matrices (WPF: all {x:…}; Avalonia: {x:…} + <x:…> elements).

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

https://github.com/MvvmAIO/MvvmAIO.Markup

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net7.0-windows7.0 is compatible.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net9.0-windows7.0 is compatible.  net10.0-windows was computed.  net10.0-windows7.0 is compatible. 
.NET Framework net461 is compatible.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 is compatible.  net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • .NETFramework 4.8.1

    • No dependencies.
  • net10.0-windows7.0

    • No dependencies.
  • net6.0-windows7.0

    • No dependencies.
  • net7.0-windows7.0

    • No dependencies.
  • net8.0-windows7.0

    • No dependencies.
  • net9.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.1 50 5/28/2026
0.3.0 43 5/28/2026
0.2.0 43 5/28/2026
0.1.3 92 5/21/2026
0.1.2 95 5/19/2026
0.1.1 87 5/19/2026
0.1.0 95 5/14/2026