Better API for overriding metadata.
Open
Enhancement Requested
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
Currently it looks like:
```cs
DefaultStyleKeyProperty.OverrideMetadata(
typeof(Button),
new FrameworkPropertyMetadata(typeof(Button)));
```
The problem is that when overriding caller needs to know the type of metadata registered to avoid:
```
ArgumentException: Metadata override and base metadata must be of the same type or derived type.
```
Overriding default value is common and we could add new API so that the framework figures out what metadata type to use:
```cs
DefaultStyleKeyProperty.OverrideDefaultValue(
typeof(Button),
typeof(Button)); // The framework then calls OverrideMetadata with the correct type.
```
Contributor guide
Assessment
This issue has not been assessed yet.