연결됨 다시 연결 중 다시 연결 초 연결 실패 연결 일시 중지 복구 실패
Duxel, a C# desktop UI library for Windows and Linux · Cover image

Duxel, a C# desktop UI library for Windows and Linux

Public posts

Build Quick Note with two files, edit its layout while it runs, and see the measured Vulkan frame rate and NativeAOT deployment size.

Hi, I’m Dimohy. I built Duxel for the kind of desktop tool I want to write in C# and run on both Windows and Linux. It uses Vulkan to draw standard widgets and custom graphics in the same window. In this post I’ll run a two-file note app, then show what I measured when I pushed the renderer and published a small NativeAOT app.

Change the layout while the app is open

I opened Quick Note on Windows, typed Duxel Fluent 2 demo, and clicked Preview. Then I edited the .duxel file, changing the heading from Quick note to Release note and the spacing from 12 to 20. When I saved the file, the same window picked up the new heading and spacing. The text in the input field and the preview both stayed put.

Before the YAML edit After the YAML edit
Quick Note with the original heading, typed text, and preview Quick Note with the Release note heading, wider spacing, and the same text and preview

What goes in each file

QuickNote.duxel defines the layout, input field, and button in YAML. Duxel compiles it into Fluent 2 C# calls. app.cs starts the app and connects the button to onPreview. The C# handler reads the typed Note value and updates the preview. If you want to change where something sits, start with the YAML. If you want to change what happens on a click, look at the C# file.

Here is the complete pair. At build time the source generator turns the YAML into Fluent 2 calls and generates the typed state behind Note and Status and the Preview event binding.

QuickNote.duxel

schema: 1
screen: QuickNote
using: [Fluent, Dux]
state:
  Status: "Enter a note to preview it."
view:
  ScrollView:
    Padding:
      all: 8
      Column:
        - spacing: 12
        - Text: { text: "Quick note", style: Title2 }
        - Input: { label: "Note", value: { bind: Note } }
        - Button: { label: "Preview note", onClick: Preview }
        - Text: { text: { read: Status } }

app.cs

#!/usr/bin/env dotnet
#:package Duxel.FluentDsl@0.4.1-fluentdsl.9

using Duxel.App;
using Duxel.Generated.Views;

using var note = QuickNoteView.Create(
    onPreview: state => state.Status.Value = string.IsNullOrWhiteSpace(state.Note.Value)
        ? "Enter a note first."
        : $"Preview: {state.Note.Value.Trim()}",
    requestFrame: DuxelApp.RequestFrame);

FluentDslHost.Run(DuxelApp.Options(note.View, title: "Duxel Quick Note", width: 440, height: 260), args);

Run the example from GitHub

Install the .NET 11 SDK and make sure Vulkan works on your system. In a Windows PowerShell terminal, clone the repository and run Quick Note.

git clone https://github.com/dimohy/Duxel.git
cd Duxel
dotnet run --file samples/fba/fluent_dsl_quickstart/app.cs

Close that instance and start it with dotnet watch --file samples/fba/fluent_dsl_quickstart/app.cs. With the app open, change the heading or spacing in QuickNote.duxel and save. The current example uses Duxel.FluentDsl 0.4.1-fluentdsl.9. For Linux and a command that fetches and runs the GitHub example, see the README.

The GitHub repository links to the Windows and Linux instructions. The file-based app guide lists more runnable examples, and the Fluent DSL guide explains the .duxel format.

How fast does the Vulkan renderer draw?

I ran the moving-polygon benchmark with 5,000 polygons, GPU collision simulation and controls in the same window. This was a 1920 × 1080 framebuffer on Windows 11 x64, with a Core Ultra 9 275HX and an RTX 5070 Ti Laptop GPU. I turned VSync off and used 1× MSAA.

Across three visible runs, with one second of warm-up and six seconds of measurement each, the per-run average was 3,697–3,778 UI frame starts per second. The median of the three P95 frame-start intervals was 0.42 ms. These are frame-loop measurements for this workload. The monitor refreshes at its own rate. See the raw results for all three runs.

Duxel benchmark running with 5,000 moving polygons and its live frame statistics

What NativeAOT changed in a small app

I timed a separate small Windows x64 app from process launch until its window marker was visible, with 15 measured runs per build. Duxel’s NativeAOT build had a median startup of 566 ms and shipped as one 12.70 MB file. The same managed Duxel app took 766 ms and totaled 98.05 MB. For this test, the Avalonia NativeAOT build started sooner (306 ms, 29.67 MB deployed) and the managed WPF build took 406 ms (152.29 MB deployed). The comparison and reproduction guide gives all configurations and the test conditions.

A separate minimal Fluent 2 sample built from source with size-saving options came to 4.85 MB on Windows x64 and 4.98 MB on Linux x64. The NativeAOT guide describes those builds.

Where I’d use Duxel

I’d start with Duxel for a Windows and Linux utility that puts familiar controls next to a custom drawing or a frequently updated view. If I already had a Windows application built around XAML, I’d look at WPF. With macOS, mobile or WebAssembly in the project requirements, I’d look at Avalonia. See the platform comparison and the documentation index for coding agents.

If you’re deciding what to put on your first screen, open the Duxel Gallery. I selected SizedBox in the Windows capture below. The Gallery shows the running example next to its C# code, so you can copy the piece you need into a file-based app, or give it to an AI coding assistant along with the change you’d like to make.

Duxel Gallery on Windows with the live SizedBox example and its C# code

0 Comments

Comments: 0

Sign in to leave a comment.

No comments yet. Write the first one.

The server connection was interrupted. Reconnect ×