2017-03-09 32 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}}" />