Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

[Showoff] Tired of DependencyProperty boilerplate? I built a Zero-Allocation Source Generator for WPF/MAUI with strict type safety.

Hey everyone, Let's face it: writing DependencyProperty in .NET UI frameworks is a chore. Typing out DependencyProperty.Register with 20 lines of boilerplate for a single property is tedious, error-prone, and severely clutters your codebase. I wanted a frictionless DX, so I built a highly optimized Source Generator: Kassyi.Generators.DependencyProperty . GitHub: Kassyi/DependencyPropertyGenerator…

.NET UI developers often find writing DependencyProperty boilerplate to be tedious, error-prone, and cluttering. Kassyi.Generators.DependencyProperty is a zero-allocation source generator that simplifies this process. By simply adding [DependencyProperty<T>], the generator creates the dependency property, properties, and callback registrations automatically.

Key features include:

1. One-line property generation: The attribute syntax automatically generates the DependencyProperty and property setters/getters.

2. Zero IDE lag: The generator eliminates Gen2 GC spikes during code generation, improving IDE performance.

3. Strict type safety: It catches signature mismatches in callbacks at compile-time, preventing runtime errors.

4. Framework agnostic: The same attribute works seamlessly across WPF, MAUI, Avalonia, Uno Platform, WinUI 3, and UWP.

5. Under the hood, it uses a custom zero-allocation engine to dramatically improve IDE performance and execution speed compared to the original generator.

This tool aims to streamline dependency property setup while maintaining strict type safety and cross-framework compatibility.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Odin's New Inline Assembly Templates

  • Odin introduces inline assembly templates for universal syntax across ISAs.
  • Templates use Intel operand order (destination, source) and are context-free grammar.
  • Parameters include integer, float, boolean, pointer, multi-pointer, or #simd[N]T.

More from Tuesday 18 August →