Skip to content

Instantly share code, notes, and snippets.

@luojunyuan
Created July 7, 2025 08:03
Show Gist options
  • Select an option

  • Save luojunyuan/802fb002bccb7fd0c80cde8e153b3e06 to your computer and use it in GitHub Desktop.

Select an option

Save luojunyuan/802fb002bccb7fd0c80cde8e153b3e06 to your computer and use it in GitHub Desktop.
blazonia app template
public partial class App : BlazoniaApplication<MainWindow>
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
}
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="11.3.2" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.2" >
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.2" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.2" />
<PackageReference Include="Blazonia" Version="0.0.0-alpha.0.888" />
</ItemGroup>
<ItemGroup>
<Compile Update="App.axaml.cs">
<DependentUpon>App.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
</Project>
@using Blazonia.Components;
@page "/"
<Window Title="Counter" Width="600" Height="400">
<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>
</Window>
@code {
int _count;
bool? _showButton = true;
void OnButtonClick() => _count++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment