如何添加垂直分隔符? [英] How to add a vertical Separator?

查看:44
本文介绍了如何添加垂直分隔符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向网格添加垂直分隔符,但我只能找到水平分隔符.不是有一个属性,你可以输入分隔线是水平还是垂直?

I want to add a vertical Separator to a Grid, but i can only find the horizontal. Isn't there a Property, where you can enter if the line of the separator should be horizontal or vertical?

我搜索了很多,但没有找到一个简短而简单的解决方案.

I searched a lot, but didn't find a short and easy solution to this.

我使用 .Net Framework 4.0 和 Visual Studio Ultimate 2012.

I use .Net Framework 4.0 and Visual Studio Ultimate 2012.

如果我尝试将水平分隔符旋转 90 度,它就会失去停靠"到其他组件的能力.

If I try to rotate the horizontal Separator by 90 degrees, it loses the ability to "dock" to other Components.

旋转后的分隔符如下所示:

The rotated separator looks like this:

<Separator HorizontalAlignment="Left" Height="100" Margin="264,26,0,0" VerticalAlignment="Top" Width="100" RenderTransformOrigin="0.5,0.5">
    <Separator.RenderTransform>
        <TransformGroup>
            <ScaleTransform/>
            <SkewTransform/>
            <RotateTransform Angle="90"/>
            <TranslateTransform/>
        </TransformGroup>
    </Separator.RenderTransform>
</Separator>

推荐答案

这应该完全符合作者的要求:

This should do exactly what the author wanted:

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

如果需要水平分隔符,请将 StackPanelOrientation 更改为 Vertical.

if you want a horizontal separator, change the Orientation of the StackPanel to Vertical.

这篇关于如何添加垂直分隔符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆