WPF Menu With Both Left and Right Alignment


This blog demonstrates how to create a menu items in WPF Whose items are in both left and right  alignment, its very easy to create a menu like this by the help of XAML in WPF. See the below xaml code: 
  1. <Window x:Class="WPFDemo.MainWindow"  
  2.         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  3.         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
  4.         xmlns:local="clr-namespace:WPFDemo"  
  5.         Title="MainWindow" Height="300" Width="300" Loaded="Window_Loaded_1">  
  6.     <Grid>  
  7.         <Menu HorizontalAlignment="Stretch" Height="30"  VerticalAlignment="Top" Padding="5">  
  8.             <Menu.ItemsPanel>  
  9.                 <ItemsPanelTemplate>  
  10.                     <DockPanel HorizontalAlignment="Stretch"></DockPanel>  
  11.                 </ItemsPanelTemplate>  
  12.             </Menu.ItemsPanel>  
  13.                 <MenuItem Header="FILE"></MenuItem>  
  14.             <MenuItem Header="EDIT"></MenuItem>  
  15.             <MenuItem Header="VIEW"></MenuItem>  
  16.             <MenuItem Header="PROJECT"></MenuItem>  
  17.             <MenuItem Header="HELP" HorizontalAlignment="Right"></MenuItem>  
  18.         </Menu>  
  19.     </Grid>  
  20. </Window>  
Next Recommended Reading Mouse Enter and Mouse Leave Event in WPF