A vertical Separator control in a Menu, Toolbar, StackPanel, etc. - Is it possible?

前端 未结 2 1861
生来不讨喜
生来不讨喜 2020-12-24 00:50

I want to use the Separator control in a vertical way (Lets say in a horizontal StackPanel).

Searching around I found this method but it doesn\'t use the Separator c

相关标签:
2条回答
  • 2020-12-24 01:26

    Also:

    <Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
    
    0 讨论(0)
  • 2020-12-24 01:29

    Vertical Separator

    <Style x:Key="VerticalSeparatorStyle" 
           TargetType="{x:Type Separator}"
           BasedOn="{StaticResource {x:Type Separator}}">
        <Setter Property="Margin" Value="6,0,6,0"/>
        <Setter Property="LayoutTransform">
            <Setter.Value>
                <TransformGroup>
                    <TransformGroup.Children>
                        <TransformCollection>
                            <RotateTransform Angle="90"/>
                        </TransformCollection>
                    </TransformGroup.Children>
                </TransformGroup>
            </Setter.Value>
        </Setter>
    </Style>
    

    Which can be used like this

    <Separator Style="{DynamicResource VerticalSeparatorStyle}" />
    
    0 讨论(0)
提交回复
热议问题