开发者

i would like to remove the underscore in the column headers of datagrid in silver light

开发者 https://www.devze.com 2023-02-10 13:13 出处:网络
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
  • 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

精彩评论

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

关注公众号