这是代码:
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<Border Name="Border" >
<Grid>
<ContentPresenter Margin="6,3,10,3" ContentSource="Header" RecognizesAccessKey="True" />
<Popup Width="auto" AllowsTransparency="True" Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsSubmenuOpen}" Focusable="False" PopupAnimation="Fade">
<Border Opacity="1" Name="SubmenuBorder" SnapsToDevicePixels="True" >
<Border.Background>
<SolidColorBrush Color="#FF9FD3F3"/>
</Border.Background>
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
<Border.BorderBrush>
<SolidColorBrush Color="Pink"></SolidColorBrush>
</Border.BorderBrush>
<Border.BorderThickness>
<Thickness Bottom="3" Top="3" Left="3" Right="3" ></Thickness>
</Border.BorderThickness>
</Border>
</Popup>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSuspendingPopupAnimation" Value="True">
<Setter TargetName="Popup" Property="PopupAnimation" Value="Fade"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect" Value="{StaticResource dropShadow}"/>
<Setter TargetName="Border" Property="Background" Value="#f9cef9"/>
</Trigger>
**<Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True">
<Setter TargetName="SubmenuBorder" Property="Padding" Value="10,0,0,3"/>
</Trigger>**
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
如何将方向放在右侧?这是一个水平菜单,当我单击子菜单下拉菜单时,没错,但是我有一个带有子菜单的子项,我希望它们以正确的方向而不是下拉菜单打开