2012-10-09 161 views
0

我正在寻找在我的系统中实现了箭头位于所选项目上的以下箭头设计。 enter image description here将导航箭头添加到菜单

目前我已经将菜单实现为ListBox,并且行为正确,减去箭头。 实现这种行为的最佳方法是什么?

目前,我已编辑的ItemsControl,并增加了箭,但它的边框内,而不是外部的边界,就像这样:

enter image description here

<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> 

回答

0

覆盖它的ItemTemplate包括一个箭头并在可以检查IsSelected状态的触发器上设置其可见性。

+0

我不确定如何使箭头在“列表框外”。我在ListBoxItem的ItemControl中实现了以下内容: 我试图设置边距,但它只是使箭头消失。 – binncheol

相关问题