WPF ToolBar Separator shrinks to nothing when inside a StackPanel

Posted by qntmfred on Stack Overflow See other posts from Stack Overflow or by qntmfred
Published on 2009-08-13T20:26:01Z Indexed on 2010/05/12 22:34 UTC
Read the original article Hit count: 268

Filed under:
|
|
|
|

Given the very simple wpf app

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="800">
    <Grid>
        <ToolBar Height="50" >
            <MenuItem Header="Test1" />
            <MenuItem Header="Test2" />

            <StackPanel Orientation="Horizontal">
                <Separator />
                <MenuItem Header="Test3" />
                <MenuItem Header="Test4" />
                <MenuItem Header="Test5" />
            </StackPanel>
        </ToolBar>
    </Grid>
</Window>

The Separator element shrinks to nothing. If I put the Separator just before the StackPanel begins, it will show up. Why does this happen? Is there a style setting that can be applied somewhere to avoid this?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml