Sadegh
Sadegh

Reputation: 4341

WPF DataGrid: Problem with showing DisplayNameAttribute values

Why WPF DataGrid control doesn't shows defined DisplayNameAttribute values for grid columns? However this works fine when using Winforms DataGridView!

Thanks a lot ;)

Upvotes: 0

Views: 275

Answers (1)

Aaron McIver
Aaron McIver

Reputation: 24723

It doesn't work that way in WPF. You could argue it's about maintaining separation of View and Model data.

The easiest way to address your concern is simply defining the column ahead of time; versus setting AutoGenerateColumns to true.

<toolkit:DataGridTextColumn Header="{x:Static const:Resources.ScriptNameHeader_String}" Binding="{Binding Name}"/>

Upvotes: 1

Related Questions