<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/building-a-custom-checkbox-avalonia-ui-deep-dive-htrvhirjt" -->

---
title: Building a Custom Checkbox: Avalonia UI Deep Dive
description: Finishing off the Avalonia Checkbox — cleaning up duplication, locking in all visual states, and pushing further towards a unified theme system. No AI...
canonical: https://daily.dev/posts/building-a-custom-checkbox-avalonia-ui-deep-dive-htrvhirjt
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Building a Custom Checkbox: Avalonia UI Deep Dive | daily.dev
og:description: Finishing off the Avalonia Checkbox — cleaning up duplication, locking in all visual states, and pushing further towards a unified theme system. No AI...
og:url: https://daily.dev/posts/building-a-custom-checkbox-avalonia-ui-deep-dive-htrvhirjt
og:image: https://api.daily.dev/og/posts/HtrVhiRJt.png
og:image:alt: Building a Custom Checkbox: Avalonia UI Deep Dive
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.

# Building a Custom Checkbox: Avalonia UI Deep Dive

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

## Summary

Finishing off the Avalonia Checkbox — cleaning up duplication, locking in all visual states, and pushing further towards a unified theme system. No AI shortcuts, just real hand-coded engineering. We fix scaling, foreground pass-through, hover states, indeterminate styling, and more.

This is part of a complete series on building a fully custom Avalonia UI theme from scratch, hand-coded with zero AI assistance.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 WHAT YOU'LL LEARN
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
• How to centralise corner radius and stroke thickness as shared static resources
• Correctly passing Foreground through TemplateBinding into child elements
• Eliminating code duplication across checkbox states using the theme colour system
• Applying numbered ThemeColor gradients for hover, pressed and disabled states
• How ViewBox and RelativeSource binding fixes checkbox scaling when size changes
• Styling all three checkbox states: Unchecked, Checked, and Indeterminate
• Replacing the indeterminate "unknown panel" with a clean dedicated rectangle
• Why style priority order matters and how to control which properties win

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⏱ TIMESTAMPS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[0:00]  – Introduction & recap — theme value sharing limitations
[0:36]  – Resuming checkbox styling & reviewing the stream geometry tick
[2:35]  – Main theme structure & TemplateBinding Foreground pass-through
[2:57]  – Introducing default corner radius & stroke thickness resources
[6:57]  – Code duplication problem & centralising theme colours
[9:08]  – Applying numbered ThemeColor gradients for visual states
[13:31] – ViewBox revisited — Grid & Panel layout for tick scaling
[16:16] – Hover (pointer over) state styling
[21:10] – Checked state styling & style priority order
[26:16] – Indeterminate state — replacing the unknown panel with a rectangle
[40:40] – Fixing checkbox scaling with ViewBox & RelativeSource height-to-width binding
[45:03] – Wrap up & next steps

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔗 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
📺 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=uv1bNrfCjtY>

---

[View this post on daily.dev](https://daily.dev/posts/building-a-custom-checkbox-avalonia-ui-deep-dive-htrvhirjt)

```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":"Building a Custom Checkbox: Avalonia UI Deep Dive","url":"https://daily.dev/posts/building-a-custom-checkbox-avalonia-ui-deep-dive-htrvhirjt","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/building-a-custom-checkbox-avalonia-ui-deep-dive-htrvhirjt"},"datePublished":"2026-10-04T13:04:30.117Z","dateModified":"2026-10-04T22:03:51.289Z","description":"Finishing off the Avalonia Checkbox — cleaning up duplication, locking in all visual states, and pushing further towards a unified theme system. No AI...","image":"https://i.ytimg.com/vi/uv1bNrfCjtY/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/uv1bNrfCjtY/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/building-a-custom-checkbox-avalonia-ui-deep-dive-htrvhirjt","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"","timeRequired":"PT45M","video":{"@type":"VideoObject","name":"Building a Custom Checkbox: Avalonia UI Deep Dive","description":"Finishing off the Avalonia Checkbox — cleaning up duplication, locking in all visual states, and pushing further towards a unified theme system. No AI...","thumbnailUrl":"https://i.ytimg.com/vi/uv1bNrfCjtY/sddefault.jpg","uploadDate":"2026-10-04T13:04:30.117Z","duration":"PT45M","url":"https://api.daily.dev/r/HtrVhiRJt","embedUrl":"https://www.youtube.com/embed/uv1bNrfCjtY"}}
{"@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":"Building a Custom Checkbox: Avalonia UI Deep Dive"}]}
```

