Where is DataGridHeaderBorder for WPF DataGrid? [duplicate]
Possible Duplicate:
WPF4 DataGridHeaderBorder in a xaml Style
I found some styles for WPF DataGrid online and all of them are for pre-release DataGrid. Now, I'm using .NET4 DataGrid, I got a compile error complaining DataGridHeaderBorder cannot be found. Based on Microsoft, it is in Microsoft.Windows.Themes namespace. No matter wh开发者_如何学Cat I try, I can't make it work.
This seems to be bug in .NET4 according to here. There is also a workaround. Just add a namespace reference like this:
xmlns:dg="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
You may have to manually add a reference to PresentationFramework.Aero
in your project.
you can also try this.. (in this case to change the foreground of the hearder)
<Style x:Key="Consulta_Grilla_HeaderStyle" TargetType="{x:Type DataGridColumnHeader}" >
<Style.Resources>
<Style TargetType="{x:Type Grid}" >
<Setter Property="TextBlock.Foreground" Value="Yellow"/>
</Style>
</Style.Resources>
</Style>
精彩评论