Making a separate question, related to comments on the answer to WPF 4: What happened to DataGridColumnHeader?
It appears I can use DataGridHeaderBorder in a UserControl, stand-alone in a ResourceDictionary, but not in a Style's setter of a Template.
<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 get it to work if I use xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit", even though I'm not referencing WPFToolkit in the project. I've verified I'm set to .NET4 and referencing PresentationFramework v4.
Thanks for helping me remove the dg: hack.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…