我有这个扩展器控件,里面有WrapPanel:
<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/>
标记,但无效
答案 0 :(得分:2)
使用此标记:
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
答案 1 :(得分:2)
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>
只需根据您的要求更改Width
的{{1}}和Background
属性。
除非您修改Border
,否则实际的Separator
元素在Windows 10上的Height
总是为1。