2012-10-09 46 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