Why is DataAnnotations ignored when using a DataGrid with AutoGenerateColumns=“True”

后端 未结 3 1647
迷失自我
迷失自我 2021-02-06 12:27

I\'m using the WPF DataGrid to bind to a collection of a custom class. Using AutoGenerateColumns=\"True\" in the grid XAML, the grid is created and populated just fine, but the

3条回答
  •  醉酒成梦
    2021-02-06 12:57

    You might try the older System.ComponentModel.DisplayNameAttribute. In C# parlance, [DisplayName("My Name")]. In particular, this works with PropertyDescriptor, which underpins a lot of data-binding.

提交回复
热议问题