Right-align help menu in a WPF application

If you want to right-align the "Help" (or any other) menu entry in your menu bar in a WPF application, you can use the following example:

<Menu>
    <Menu.ItemsPanel>
        <ItemsPanelTemplate>
            <DockPanel HorizontalAlignment="Stretch"/>
        </ItemsPanelTemplate>
    </Menu.ItemsPanel>
    <MenuItem Header="File">
        <MenuItem Header="Exit"/>
    </MenuItem>
    <MenuItem Header="Edit">
        <MenuItem Header="Cut"/>
    </MenuItem>
    <MenuItem Header="Help" HorizontalAlignment="Right">
        <MenuItem Header="About"/>
    </MenuItem>
</Menu>

Code sample taken from here.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
Please confirm you are a human being
Image CAPTCHA
Enter the characters shown in the image.