2017-03-09 34 views
1

我在它與WrapPanel這個膨脹機控制:裹面板項分隔符WPF

<Expander Background="Black"> 
       <Expander.Header> 
        <BulletDecorator> 
         <BulletDecorator.Bullet> 
          <Image Source="../Images/Button/customiseButton_Transparent.png" Width="64" Height="64" HorizontalAlignment="Left" VerticalAlignment="Top" /> 
         </BulletDecorator.Bullet> 
         <TextBlock Margin="10,0,0,0" Text="Customize" VerticalAlignment="Center" HorizontalAlignment="Stretch" Foreground="White" /> 
        </BulletDecorator> 
       </Expander.Header> 
       <WrapPanel> 
        <StackPanel Orientation="Horizontal"> 
         <Image Source="Images/Button.png" /> 
         <Label Content="Phone" Foreground="Snow" VerticalAlignment="Center"/> 
        </StackPanel> 
        <StackPanel Orientation="Horizontal"> 
         <Image Source="Images/Button.png" /> 
         <Label Content="Colour" Foreground="Snow" VerticalAlignment="Center"/> 
        </StackPanel> 
       </WrapPanel> 
      </Expander> 

我需要一個顯示兩個疊層板之間的白色分隔符。

我曾嘗試加入<Seperator/>標籤,但它不工作

+2

標籤: - ** **不是

回答

1

一個Separator無非是一個Border元素確實所以這應該只是罰款:

<WrapPanel> 
    <StackPanel Orientation="Horizontal"> 
     <Image Source="Images/Button.png" /> 
     <Label Content="Phone" Foreground="Snow" VerticalAlignment="Center"/> 
    </StackPanel> 
    <Border Width="2" Background="Red" /> 
    <StackPanel Orientation="Horizontal"> 
     <Image Source="Images/Button.png" /> 
     <Label Content="Colour" Foreground="Snow" VerticalAlignment="Center"/> 
    </StackPanel> 
</WrapPanel> 

只要更改WidthBackground根據您的要求Border的屬性。

實際的Separator元素在Windows 10上始終有Height = 1,除非您修改其ControlTemplate

1

使用該標籤:

<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />