Add support for design time discoverability of default style key.
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
**Feature request:** add support for design time discoverability of default style key.
**Goal:** VS XAML intellisense to support Copy Style/Template without running app. Mostly for platform controls like Button and 3rd party SDKs like Telerik.
**Details:** when creating WPF Core Custom Control Library project in VS, the project contains following:
themes/generic.xaml
MyControl.cs
public class MyControl : Control
{
static MyControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MyControl), new FrameworkPropertyMetadata(typeof(MyControl)));
}
}
This is not design time friendly as we cannot find default style key via Roslyn INamedTypeSymbol for MyControl. One way to fix it is to add DefaultStyleKeyAttribute, e.g.
[DefaultStyleKey(typeof(MyControl))]
public class MyControl : Control
Note that VS project and item templates should be updated to DefaultStyleKeyAttribute.
Contributor guide
Assessment
This issue has not been assessed yet.