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

C#WpfMenuToolbarSeparator

C# Problem Overview


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 control rather it uses borders and rectangles. https://social.msdn.microsoft.com/forums/en-US/wpf/thread/eab865be-ad9b-45ed-b9d8-fc93f737b163

Is it possible to use the Separator control in a vertical way?

C# Solutions


Solution 1 - C#

Also:

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

Solution 2 - C#

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}" />

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRandall FlaggView Question on Stackoverflow
Solution 1 - C#mletterleView Answer on Stackoverflow
Solution 2 - C#Fredrik HedbladView Answer on Stackoverflow