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
By using @GilShalit post upon, this is what is needed to add in case that you are using Resources (as you probably should for multi culture language support) in C# in this time
Your property Declaration with Annotation
[Display(ResourceType = typeof (YourStronglyTypedMessagesResource), Name = "YourGridColumnName")]
public string Column1 { get; set; }
Event handler
private void DataGrid_OnAutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
var pd = (PropertyDescriptor)e.PropertyDescriptor;
var atb = (DisplayAttribute)pd.Attributes[typeof(DisplayAttribute)];
if (atb != null)
{
e.Column.Header = atb.GetName();
}
}