You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for design time discoverability of default style key. #1551
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
<ResourceDictionary . . .>
<Style TargetType="{x:Type local:MyControl}">
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.
Activity