开发者

Where is DataGridHeaderBorder for WPF DataGrid? [duplicate]

This question already has answers here: Closed 11 years ago.

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>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜