Blazonia 11.3.0

dotnet add package Blazonia --version 11.3.0
                    
NuGet\Install-Package Blazonia -Version 11.3.0
                    
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="Blazonia" Version="11.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Blazonia" Version="11.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Blazonia" />
                    
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 Blazonia --version 11.3.0
                    
#r "nuget: Blazonia, 11.3.0"
                    
#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 Blazonia@11.3.0
                    
#: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=Blazonia&version=11.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Blazonia&version=11.3.0
                    
Install as a Cake Tool

🪢 Blazonia

Nuget

English | 中文

🤔 What is this?

Blazonia enables developers to use the <a href="https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor">Blazor</a> syntax to build <a href="https://avaloniaui.net/">Avalonia</a> applications. Compared to Avalonia’s original XAML syntax, Blazonia’s Blazor-based approach is more concise and straightforward, allowing you to develop pages using a single file. It is particularly suitable for small to medium-sized client applications.

Note

  • 🚫 After using Blazonia, there will be no HTML code or WebView components involved.
  • 🤩 Fully utilizes native Avalonia controls

Thanks to Avalonia's cross-platform capabilities, Blazonia enables developers to rapidly build beautiful, pixel-perfect applications for 💻 desktop, 📱 mobile, and 🌐 web platforms.

🌰 A Simple Example

<StackPanel>
    <Label FontSize="30">You pressed @_count times </Label>
    <CheckBox @bind-IsChecked="_showButton">Button visible</CheckBox>
    @if (_showButton == true)
    {
        <Button OnClick="OnButtonClick">+1</Button>
    }
</StackPanel>

@code {

    int _count;
    
    bool? _showButton = true;
    
    void OnButtonClick() => _count++;
}

Counter

🛫 Getting Start

New Project

  1. Install the project template
dotnet new install BlazoniaTemplate
  1. Create a new project with the template
dotnet new blazonia -o BlazoniaApp

Use in an Existing Project

  1. Install Blazonia
dotnet add package Blazonia
  1. Create a new Razor component

<StackPanel>
    <TextBlock FontSize="30">Hello World</TextBlock>
</StackPanel>
  1. Use Blazonia controls in axaml
<UserControl 
            ...
			 xmlns:b="https://blazonia.github.io"
			 xmlns:pages="clr-namespace:YourProject.RazorPages"
             ...
             >
	<b:BlazoniaControl x:TypeArguments="pages:Hello"/>
</UserControl>

📃 Razor Page Navigation?

  1. Replace BlazoniaControl with BlazoniaNavigationControl control
<UserControl 
            ...
			 xmlns:b="https://blazonia.github.io"
			 xmlns:pages="clr-namespace:YourProject.RazorPages"
             ...
             >
	<b:BlazoniaNavigationControl x:TypeArguments="pages:Page1"/>
</UserControl>
  1. Inject the INavigation object for page navigation

@inject INavigation Navigation

<StackPanel>
    <TextBlock FontSize="30">Page 1</TextBlock>
    <Button OnClick="@OnButtonClick">Go to Page2</Button>
</StackPanel>

@code {
    async Task OnButtonClick()
    {
        await Navigation.NavigateToAsync("/page2", null);
    }
}
  1. Use the @page attribute to mark the url

@page "/page2"
@inject INavigation Navigation

<StackPanel>
    <TextBlock FontSize="30">Page 2</TextBlock>
    <Button OnClick="@OnButtonClick">Back</Button>
</StackPanel>

@code {
    async Task OnButtonClick()
    {
        await Navigation.PopAsync();
    }
}

✂ NativeAot and Trimming

Blazonia supports NativeAot and trimming features, but you need to add the TrimmerRootDescriptor property to your project to let the trimmer preserve all metadata of the Razor components


<linker>
	<assembly fullname="YourProject">
		<namespace fullname="Razor Component NameSpace" preserve="all" />
	</assembly>
</linker>

<Project Sdk="Microsoft.NET.Sdk">
     ...
	<ItemGroup>
		<TrimmerRootDescriptor Include="..\root.xml" />
	</ItemGroup>
</Project>

⚠️ Notes

Please use Rider or VS Code to develop the project, as the code hints for razor files in Visual Studio 2022 may fail.

🗨 Communication

  1. Discord Server: https://discord.gg/qtDKFgRAcg
  2. QQ Group: 1063998889

QQ Group

This project is based on multiple upstream repositories. See NOTICE for details.

Product 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Blazonia:

Package Downloads
Consolonia.Blazor

This package provides the ability to use Blazor .razor files to create console apps using Consolonia.

Blazonia.HelloWorld

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Blazonia:

Repository Stars
Consolonia/Consolonia
A cross-platform UI framework for .NET.
Version Downloads Last Updated
11.3.0 109 12/27/2025
11.2.1 100 12/27/2025
0.0.0-alpha.0.901 247 12/22/2025
0.0.0-alpha.0.900 75 12/20/2025
0.0.0-alpha.0.899 76 12/20/2025
0.0.0-alpha.0.897 247 12/17/2025
0.0.0-alpha.0.894 2,240 7/7/2025
0.0.0-alpha.0.890 175 4/21/2025
0.0.0-alpha.0.889 197 4/17/2025
0.0.0-alpha.0.888 225 4/16/2025
0.0.0-alpha.0.887 185 4/16/2025
0.0.0-alpha.0.886 183 4/16/2025
0.0.0-alpha.0.882 212 4/15/2025
0.0.0-alpha.0.881 193 4/15/2025
0.0.0-alpha.0.880 251 4/16/2025