繁体   English   中英

包装面板项目分隔符WPF

[英]Wrap Panel Items Separator WPF

我有一个带有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/>标记,但是它不起作用

使用此标签:

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

实际上, 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>

只需根据您的要求更改“ Border的“ Width和“ Background属性。

除非您修改其ControlTemplate否则实际的Separator元素在Windows 10上的Height始终为1。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM