dotnet / dotnet/wpf

DictionaryKeyPropertyAttribute not working

Open
#7,562 4 comments 2 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

Class define with `DictionaryKeyPropertyAttribute` still show `All objects added to an IDictionary must have a Key attribute or some other type of key associated with them.` error while building project.

### Reproduction Steps

Define a class with `DictionaryKeyPropertyAttribute`.
```
[DictionaryKeyProperty("TargetType")]
public class MyStyle
{
public MyStyle()
{

}

public Type TargetType { get; set; }
}
```
Use it in a xaml file.
```







```

### Expected behavior

Build successful

### Actual behavior

Build failed

### Regression?

_No response_

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

_No response_

### Other information

[WpfApp1.zip](https://github.com/dotnet/wpf/files/10802921/WpfApp1.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.