CommunityToolkit / CommunityToolkit/Labs-Windows
🧪 [Experiment] DependencyPropertyGenerator
- Dominant language
- C#
- Stars
- 482
- Forks
- 89
- PR merge metrics
- No merged PRs in 30d
Description
> [!NOTE]
> Originally from https://github.com/CommunityToolkit/Labs-Windows/discussions/449.
## Overview
Tracking issue for the new `DependencyProperty` generator, for UWP (both .NET Native and .NET 9) and WinUI 3.
This is what using the new generator looks like:
```csharp
[GeneratedDependencyProperty]
public string? Name { get; set; }
```
It only supports instance properties. Attached properties are not currently supported.
## Remaining task
Here's a few remaining tasks to track work:
- [x] Codegen for `DefaultValueCallback`
- [x] Improve formatting for `PropertyMetadata` construction
- [x] Diagnostic for using `DefaultValue` and `DefaultValueCallback` at the same time
- [x] Diagnostic for `DefaultValueCallback` set to `null`
- [x] Diagnostic for `DefaultValueCallback` not matching an existing method
- [x] Diagnostic for `DefaultValueCallback` matching an invalid method (eg. wrong signature)
- [x] Diagnostic for properties that end with the "Property" suffix
- [x] Handle generic containing types
- [x] Handle `default(T)` for default values on unconstrained generic type parameters
- [x] Diagnostics for `[NotNull]` on property getters
Contributor guide
Assessment
This issue has not been assessed yet.