Deniz Dogan
Deniz Dogan

Reputation: 26227

WPF: The correct way to make a standard menu

I've just started out fiddling with WPF in Expression Blend and now I'm trying to design a "normal Windows GUI" interface with a menu at the very top and some other stuff which takes up the rest of the window.

Which panel do I use to make the menu always stay at the very top, take up only as much height as it needs to fit the menu items and fill the entire width of the window, in such a way that I can just fill in other panels and what-not in the rest of the window?

Upvotes: 1

Views: 654

Answers (1)

kenwarner
kenwarner

Reputation: 29120

    <DockPanel LastChildFill="True">
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="Foo" />
        </Menu>

        <!-- Use whatever panel you want here -->            
        <StackPanel>
            <TextBlock Text="Bar" />
        </StackPanel>
    </DockPanel>

Upvotes: 4

Related Questions