private void Button_Click(object sender, RoutedEventArgs e)
{
foreach (var x in this.sfGrid.Columns)
{
x.HeaderText = ((DataTable)this.sfGrid.ItemsSource).Columns[x.HeaderText].Caption;
}
} |
this.sfGrid.AutoGeneratingColumn += SfGrid_AutoGeneratingColumn;
private void SfGrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnArgs e)
{
e.Column.HeaderText = _viewManager.GridData.Columns[e.Column.HeaderText].Caption;
} |
Thank you. The AutoGeneratingColumn event solution worked best for me.
this.BlockOutputDataGrid.AutoGeneratingColumn += dataGrid_AutoGeneratingColumn;
private void dataGrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnArgs e)
{
// Column header renaming using caption
e.Column.HeaderText = ((DataTable)this.BlockOutputDataGrid.ItemsSource).Columns[e.Column.HeaderText].Caption;
}