<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/avalonia-ui-theming---theme-engine-from-scratch-no-ai-ygenznifb" -->

---
title: Avalonia UI Theming - Theme Engine From Scratch | No AI
description: Avalonia has never had a proper theme engine — until now. After a full week of deep refactoring, I've designed and built a brand new C#-driven theme engine...
canonical: https://daily.dev/posts/avalonia-ui-theming---theme-engine-from-scratch-no-ai-ygenznifb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Avalonia UI Theming - Theme Engine From Scratch | No AI | daily.dev
og:description: Avalonia has never had a proper theme engine — until now. After a full week of deep refactoring, I've designed and built a brand new C#-driven theme engine...
og:url: https://daily.dev/posts/avalonia-ui-theming---theme-engine-from-scratch-no-ai-ygenznifb
og:image: https://api.daily.dev/og/posts/YgeNzNifb.png
og:image:alt: Avalonia UI Theming - Theme Engine From Scratch | No AI
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Avalonia UI Theming - Theme Engine From Scratch | No AI

**[AngelSix](https://daily.dev/sources/angelsix)** · 21 min read · 0 upvotes · 0 comments

## Summary

Avalonia has never had a proper theme engine — until now. After a full week of deep refactoring, I've designed and built a brand new C#-driven theme engine that replaces static XAML resource dictionaries with dynamic, MVVM-bound, fully IntelliSense-supported theme properties. No AI wrote this. A real person architected every piece.

This is the biggest leap forward in the series so far. The entire theming system has been reduced to just two classes and a NuGet package — and it gives you absolute power over your themes: live switching, data-bound values, even themes that react to external events in real-time.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 WHAT YOU'LL LEARN
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
• Why defining themes in XAML is fundamentally limiting — and the case for C# instead
• How current Avalonia theming fails: hard-coded values, no IntelliSense, no binding
• The dead ends I hit (including why modifying XAMLX was a non-starter)
• The breakthrough: markup extensions as the entry point for theme:PropertyName syntax
• Full IntelliSense for every theme property directly in XAML
• ThemeContext — a singleton injected via DI that holds the active theme
• Themes as simple C# classes inheriting from an abstract Theme base
• Live theme switching: toggle themes at runtime and watch the UI update instantly
• Binding theme values to external data — including a demo where BaseScale changes every second from the system clock
• Auto-generated C# files that power the IntelliSense and markup resolution

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⏱ TIMESTAMPS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[0:00]  – Introduction — a week of redesigning the theme system
[2:29]  – Why XAML is the wrong place to define themes
[4:50]  – The XAMLX dead end — why patching the compiler wasn't viable
[7:24]  – The breakthrough: markup extensions & the new architecture
[9:15]  – ThemeContext, dependency injection & the singleton pattern
[10:30] – Themes as C# classes — inheriting from abstract Theme
[12:02] – Full IntelliSense demo for theme: syntax in XAML
[13:45] – Live theme switching — toggling themes at runtime
[15:20] – Binding ThemeContext in XAML & the single naming requirement
[16:10] – How auto-generated files power the system behind the scenes
[20:00] – The crazy demo: BaseScale driven by the system clock
[21:07] – Wrap up & what's next

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔗 LINKS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▶ Part 1 – Setup: https://www.youtube.com/watch?v=rUKlQnjU0tc
▶ Part 2 – Buttons: https://www.youtube.com/watch?v=oKjk6pyyARI
▶ Part 3 – Button Spinner Anatomy: https://www.youtube.com/watch?v=WMaTbXkvm9g
▶ Part 4 – Designing a Theme System: https://www.youtube.com/watch?v=I5halHoNfH0
▶ Part 5 – Checkbox Anatomy: https://www.youtube.com/watch?v=uIimnwjITT0
▶ Part 6 – Checkbox Styling: https://www.youtube.com/watch?v=uv1bNrfCjtY
📺 Full Series Playlist: https://www.youtube.com/playlist?list=PLrW43fNmjaQVE2vDBeWD8QYIm06w6bKyO
💾 Source Code: https://github.com/angelsix/youtube/tree/develop/AvaloniaThemeLab
🌐 AngelSix: https://www.angelsix.com

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📺 SERIES: Avalonia UI Theming – Hand Coded From Scratch
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

#avalonia #avaloniaui #xaml #csharp #dotnet #uiux #desktopapp #softwaretutorial #coding

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=NXz8hwITg5U>

---

[View this post on daily.dev](https://daily.dev/posts/avalonia-ui-theming---theme-engine-from-scratch-no-ai-ygenznifb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Avalonia UI Theming - Theme Engine From Scratch | No AI","url":"https://daily.dev/posts/avalonia-ui-theming---theme-engine-from-scratch-no-ai-ygenznifb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/avalonia-ui-theming---theme-engine-from-scratch-no-ai-ygenznifb"},"datePublished":"2026-10-04T13:04:35.111Z","dateModified":"2026-10-04T22:09:44.927Z","description":"Avalonia has never had a proper theme engine — until now. After a full week of deep refactoring, I've designed and built a brand new C#-driven theme engine...","image":"https://i.ytimg.com/vi/NXz8hwITg5U/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/NXz8hwITg5U/sddefault.jpg","isAccessibleForFree":true,"articleSection":"AngelSix","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"AngelSix","logo":"https://media.daily.dev/image/upload/s--h1ikmN_u--/f_auto,q_auto/v1791119063/logos/angelsix?_a=BAMAMicg0","url":"https://daily.dev/sources/angelsix"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/avalonia-ui-theming---theme-engine-from-scratch-no-ai-ygenznifb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"","timeRequired":"PT21M","video":{"@type":"VideoObject","name":"Avalonia UI Theming - Theme Engine From Scratch | No AI","description":"Avalonia has never had a proper theme engine — until now. After a full week of deep refactoring, I've designed and built a brand new C#-driven theme engine...","thumbnailUrl":"https://i.ytimg.com/vi/NXz8hwITg5U/sddefault.jpg","uploadDate":"2026-10-04T13:04:35.111Z","duration":"PT21M","url":"https://api.daily.dev/r/YgeNzNifb","embedUrl":"https://www.youtube.com/embed/NXz8hwITg5U"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"AngelSix","item":"https://daily.dev/sources/angelsix"},{"@type":"ListItem","position":3,"name":"Avalonia UI Theming - Theme Engine From Scratch | No AI"}]}
```

