このスタイルを WPF DataGrid に適用すると、列ヘッダーのコンテキスト メニューが表示されません。このスタイルを削除すると表示されます。このスタイルのどこが間違っているか、欠けているか?
<Style x:Key="DefaultColumnHeader"
TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
<dg:DataGridHeaderBorder x:Name="dataGridHeaderBorder"
Margin="-1 0 0 0"
VerticalAlignment="Top"
Height="24"
IsClickable="{TemplateBinding CanUserSort}"
IsHovered="{TemplateBinding IsMouseOver}"
IsPressed="{TemplateBinding IsPressed}"
SeparatorBrush="{TemplateBinding SeparatorBrush}"
SeparatorVisibility="{TemplateBinding SeparatorVisibility}"
SortDirection="{TemplateBinding SortDirection}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
Grid.ColumnSpan="1">
<Grid x:Name="grid"
Width="Auto"
Height="Auto"
RenderTransformOrigin="0.5,0.5"
Margin="-5 0 -5 0">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Grid.RenderTransform>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Thumb x:Name="PART_LeftHeaderGripper"
Grid.Column="0"
HorizontalAlignment="Left"
Width="3"
BorderThickness="0"
Background="Transparent"
Cursor="SizeWE"
Margin="0"
Template="{StaticResource ThumbTemplate}" />
<ContentPresenter x:Name="contentPresenter"
Grid.Column="1"
Margin="2 0"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}">
<ContentPresenter.Content>
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="Content" />
</ContentPresenter.Content>
</ContentPresenter>
<Thumb x:Name="PART_RightHeaderGripper"
Grid.Column="2"
HorizontalAlignment="Right"
Width="3"
BorderThickness="0"
Background="Transparent"
Cursor="SizeWE"
Margin="0"
Template="{StaticResource ThumbTemplate}" />
</Grid>
</dg:DataGridHeaderBorder>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>