Setting correctly the properties of a main menu in WPF
Sep
13
Written by:
9/13/2012 1:08 PM
Since it tooks me a few minutes to retrieve the right proeprties to set in order to have a main menu, this article describes exactly what to do to have:
- no margin between the menu and the title bar
- have the main toolbar menu that is resized with the main window
The steps to follow are the following ones:
- no need to add a docking panel, the initial WPF windows template is sufficient,
- set the VerticalAlignment to top, in order to have no blank line between the the menu and the title bar (wee below),
- set the HorizontalAligment to Stretch (see below)
- and last but not least, set the Width to Auto
Another solution exists by mapping the width of the menu with the width of the grid container as below: