开发者

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("_", " ");
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜