C# 将导航箭头添加到菜单
我希望在我的系统中实现以下箭头设计,其中箭头位于所选项目上。 目前,我已经将菜单实现为一个列表框,除箭头外,它的行为正常。 实现这种行为的最佳方法是什么 目前,我编辑了ItemsControl并添加了一个箭头,但它位于边框内,而不是边框外,如下所示:C# 将导航箭头添加到菜单,c#,wpf,xaml,user-interface,navigation,C#,Wpf,Xaml,User Interface,Navigation,我希望在我的系统中实现以下箭头设计,其中箭头位于所选项目上。 目前,我已经将菜单实现为一个列表框,除箭头外,它的行为正常。 实现这种行为的最佳方法是什么 目前,我编辑了ItemsControl并添加了一个箭头,但它位于边框内,而不是边框外,如下所示: <ControlTemplate TargetType="{x:Type ListBoxItem}"> <Grid> <Bord
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Grid>
<Border Name="Border">
<ContentPresenter Content="{TemplateBinding Content}" />
</Border>
<Path Name="SelectedArrow" Data="{StaticResource RightArrow}" Width="10" Height="20" Stretch="Fill" Fill="White" HorizontalAlignment="Right" Visibility="Collapsed" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter TargetName="SelectedArrow" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
覆盖它的ItemTemplate以包含箭头,并在触发器上设置其可见性,该触发器可检查IsSelected的条件。我不确定如何使箭头位于列表框的“外部”。我在ListBoxItem的ItemControl中实现了以下功能:
我尝试设置边距,但它只是使箭头消失。