Uploaded March 2020 | Updated November 2026, 2 hours ago
Support me in my journey to giving back to the industry all my knowledge and helping the world with what I do. Spreading knowledge to those who cannot afford an education, and helping those who want to better themselves.
Support what I do and pay for me to survive
angelsix.com/donate
Merchandise
teespring.com/stores/angelsix
My Setup & Recommendations
amazon.co.uk/shop/angelsix
Live Chat at Discord
discordapp.com/invite/eHr5BMk
Source Code
github.com/angelsix/course-csharp-mastery
Support me in my journey to giving back to the industry all my knowledge and helping the world with what I do. Spreading knowledge to those who cannot afford an education, and helping those who want to better themselves.
Support what I do and pay for me to survive
angelsix.com/donate
Merchandise
teespring.com/stores/angelsix
My Setup & Recommendations
amazon.co.uk/shop/angelsix
Live Chat at Discord
discordapp.com/invite/eHr5BMk
Source Code
github.com/angelsix/course-csharp-mastery









![Avalonia Calendar Control From Scratch (Multiple Selection Modes)
The Avalonia theme engine just met the first control that genuinely tests it — a calendar, hand-coded from scratch.
This is the honest episode: I fix the bugs I left in rather than pretend the first version was right. The drop down that wont expand to fit its content, the calendar that changes size when expanded, and a selection state still hardcoded black and purple instead of bound to an accent colour — all of it found by reading 400 lines of XAML cold.
Along the way: a side-by-side dark theme preview, day cell selection states bound to accent brushes, the keyboard focus state pulling the wrong brush, and a size jump fixed with opacity instead of visibility. Part of a complete series on building a fully custom Avalonia UI theme from scratch, hand-coded with zero AI.
━━━━━━━━━━━━━━━━━━━
📌 WHAT YOULL LEARN
━━━━━━━━━━━━━━━━━━━
• How to read a large XAML control file you didnt write — the background-override trick for spotting sections at a glance
• Why the drop down text box wont expand to fit content, and the HorizontalAlignment stretch fix
• The Chrome-less text box that removes a default focus ring without breaking the control
• Why the calendar changes size when expanding from month to year — the visibility vs opacity trade-off
• How to bind day cell selection states to accent brushes, and which brush the keyboard focus state should use
• How Theme.Kind retints the entire calendar instantly, and where event dots will attach
━━━━━━━━━━━━━━━━━━━
⏱ TIMESTAMPS
━━━━━━━━━━━━━━━━━━━
[0:00] – No more ugly calendar — the plan and the bugs
[0:14] – The calendar view, the source commit, and getting these C# controls into Avalonia
[0:49] – The next feature: event dots and custom event values
[1:11] – Theme library issues, and why this file is 400+ lines
[1:28] – Single date, date range, month select, year select
[1:53] – The drop down picker version
[2:05] – Bug 1 — the text box doesnt expand to fit content
[2:21] – Bug 2 — the calendar changes size when expanded
[2:59] – Is the selection actually bound to an accent colour?
[3:37] – Reading 400 lines of XAML cold — my thought process
[4:16] – Selection modes — none, single, range
[5:19] – Finding the header by overriding the background
[7:26] – The Chrome-less text box — removing the focus ring
[10:14] – The marker strip — where event dots will live
[11:13] – Day and date cells — all the binding is in C#
[12:11] – The black and purple selection problem
[12:23] – Adding a dark theme preview side by side
[14:36] – Binding selection states to accent brushes
[17:28] – Fixing the in-range band styling
[18:30] – Fixing the keyboard focus state
[19:34] – Retinting with Theme.Kind — success, destructive, primary
[22:00] – Softening the selected border brush
[23:48] – The calendar size change — setting a fixed 500x500 to prove it
[26:01] – Visibility vs opacity — solving the size jump
[27:47] – Settling on natural growth as the default
[28:40] – Fixing the drop down text box width
[30:43] – Whats next — event dots and an event viewer
[31:41] – Sign off
━━━━━━━━━━━━━━━━━━━
🔗 LINKS & RESOURCES
━━━━━━━━━━━━━━━━━━━
▶ Full Avalonia Themes Playlist: https://www.youtube.com/playlist?list=PLrW43fNmjaQVE2vDBeWD8QYIm06w6bKyO
▶ Source Code (AvaloniaThemeLab): https://github.com/angelsix/youtube/tree/develop/AvaloniaThemeLab
▶ GitHub: https://github.com/angelsix
▶ Website: https://www.angelsix.com
━━━━━━━━━━━━━━━━━━━
📚 SERIES — Avalonia UI Theming, Hand Coded From Scratch
━━━━━━━━━━━━━━━━━━━
01 — Setup — https://www.youtube.com/watch?v=rUKlQnjU0tc
02 — Buttons — https://www.youtube.com/watch?v=oKjk6pyyARI
03 — Button Spinner Anatomy — https://www.youtube.com/watch?v=WMaTbXkvm9g
04 — Designing a Theme System — https://www.youtube.com/watch?v=I5halHoNfH0
05 — Checkbox Control Deep Dive — https://www.youtube.com/watch?v=uIimnwjITT0
06 — Building a Custom Checkbox — https://www.youtube.com/watch?v=uv1bNrfCjtY
07 — Theme Engine From Scratch — https://www.youtube.com/watch?v=NXz8hwITg5U
08 — Building a Design Token System — https://www.youtube.com/watch?v=QMVdxRZqaU8
09 — I Let AI Refactor Everything — https://www.youtube.com/watch?v=5-p_fnOi0As
10 — One Token System for the Entire Theme — https://www.youtube.com/watch?v=JEcD1XXIiA8
11 — Avalonia Styles Not Working? — https://www.youtube.com/watch?v=OhJN8Ssp2hA
12 — A Full Icon System — https://www.youtube.com/watch?v=N5HPe5GYCPo
13 — Breaking Every Control On Purpose — https://www.youtube.com/watch?v=OmVFU-iowqI
14 — A Tool That Finds Bugs My Compiler Cant See — https://www.youtube.com/watch?v=WQB5kFJWRmc
15 — The Accent System — https://www.youtube.com/watch?v=YFQEVLaYk94
16 — The Color Ramp That Themes Your Whole App — https://www.youtube.com/watch?v=xhnUQOOrShs
17 — A Maintainable Token System — https://www.youtube.com/watch?v=tg2gSQRJtmY
18 — Automatic Dark Mode From a Single Theme — https://www.youtube.com/watch?v=m2WjfZAOUyM
19 — This Video — Calendar Control From Scratch Avalonia Calendar Control From Scratch (Multiple Selection Modes)](https://i.ytimg.com/vi/EZE8MFbcoAE/mqdefault.jpg)
