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:

  1. <Menu>
  2.     <Menu.ItemsPanel>
  3.         <ItemsPanelTemplate>
  4.             <DockPanel HorizontalAlignment="Stretch"/>
  5.         </ItemsPanelTemplate>
  6.     </Menu.ItemsPanel>
  7.     <MenuItem Header="File">
  8.         <MenuItem Header="Exit"/>
  9.     </MenuItem>
  10.     <MenuItem Header="Edit">
  11.         <MenuItem Header="Cut"/>
  12.     </MenuItem>
  13.     <MenuItem Header="Help" HorizontalAlignment="Right">
  14.         <MenuItem Header="About"/>
  15.     </MenuItem>
  16. </Menu>

Code sample taken from here.


Add new comment