i would like to remove the underscore in the column headers of datagrid in silver light
- select me as "you are the best" from table;
but datagrid header displays
- you_are_the_best
how sho开发者_开发技巧uld i stop this underscore??
If you don't know the columns at compile time, you'll need to handle the AutoGeneratingColumns event as in the following example:
<data:DataGrid ItemsSource="..." AutoGenerateColumns="True" AutoGeneratingColumn="FormatColumnHeader">
</data:DataGrid>
private void FormatColumnHeader(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
e.Column.Header = ...
}
column.Header = "your header"
or
<sdk:DataGridTemplateColumn Header="your header"/>
Is this what you mean?
void dataGrid2_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
//throw new System.NotImplementedException();
e.Column.Header = ((string)e.Column.Header).Replace("_", " ");
}
精彩评论