[ACCEPTED]-WPF separator between grid buttons-separator

Accepted answer
Score: 25

In case anyone else stumbles across this, easiest 1 solution:

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

Have you tried a GridSplitter?

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Height="*" />
        <ColumnDefinition Height="Auto" />
        <ColumnDefinition Height="100" />
        <ColumnDefinition Height="100" />
    </Grid.ColumnDefinitions>
    <Button/>
    <Button/>
    <GridSplitter ResizeDirection="Columns" Grid.Column="2" Height="Auto" Width="4" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0"/>
    <Button/>
</Grid>

0

Score: 2

I usually use the simple choice to add a 3 column with a fixed width between the buttons You 2 can actually use a different background 1 color or insert an image

Score: 1

You can use Separator if you style it correctly. By 8 default it creates a horizontal line. You 7 have to apply different styling to make 6 it vertical. See this post for how to style 5 it as a vertical line in a WPF Grid:

CodeProject discussion

The 4 discussion also mentions that StatusBar 3 applies some styling to Separator elements, as 2 long as you don't wrap them in StatusBarItems. Perhaps 1 StackPanel does something similar.

More Related questions