WPF4 xaml style DataGridHeaderBorder

Create a separate question related to the comments on the answer to WPF 4: What happened to the DataGridColumnHeader?

It seems I can use the DataGridHeaderBorder in the UserControl, standalone in the ResourceDictionary, but not in the template style installer.

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <!-- Works --> <DataTemplate x:Key="yomama"> <DataGridColumnHeader /> </DataTemplate> <!-- Compile Error: error MC3074: The tag 'DataGridHeaderBorder' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'. --> <Style x:Key="{x:Type DataGridRowHeader}" TargetType="{x:Type DataGridRowHeader}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataGridRowHeader}"> <Grid> <DataGridHeaderBorder></DataGridHeaderBorder> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> 

I can make it work if I use xmlns: dg = "http://schemas.microsoft.com/wpf/2008/toolkit", although I am not referring to WPFToolkit in the project. I have verified that I am configured for .NET4 and am referencing PresentationFramework v4.

Thanks for helping me remove dg: hack.

+2
wpf xaml wpfdatagrid datagridheaderborder
source share
3 answers

Try:

 xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" 
+7
source share

You can also try this. In this case, change the foreground of the header.

 <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> 
+2
source share

Add PresentationFramework.Aero.dll to the link of your project.

-one
source share

All Articles