MvvmAIO.Markup.WPF
0.3.0
See the version list below for details.
dotnet add package MvvmAIO.Markup.WPF --version 0.3.0
NuGet\Install-Package MvvmAIO.Markup.WPF -Version 0.3.0
<PackageReference Include="MvvmAIO.Markup.WPF" Version="0.3.0" />
<PackageVersion Include="MvvmAIO.Markup.WPF" Version="0.3.0" />
<PackageReference Include="MvvmAIO.Markup.WPF" />
paket add MvvmAIO.Markup.WPF --version 0.3.0
#r "nuget: MvvmAIO.Markup.WPF, 0.3.0"
#:package MvvmAIO.Markup.WPF@0.3.0
#addin nuget:?package=MvvmAIO.Markup.WPF&version=0.3.0
#tool nuget:?package=MvvmAIO.Markup.WPF&version=0.3.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 |
✓ | ✓ | |
Color |
✓ | ✓ | e.g. {x:Color '#FFFF0000'} (WPF) or {m:Color …} (Avalonia) |
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 ({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 | 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. |
-
.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.