Introduction
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:
- <Window x:Class="WPFDemo.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="clr-namespace:WPFDemo"
- Title="MainWindow" Height="300" Width="300" Loaded="Window_Loaded_1">
- <Grid>
- <Menu HorizontalAlignment="Stretch" Height="30" VerticalAlignment="Top" Padding="5">
- <Menu.ItemsPanel>
- <ItemsPanelTemplate>
- <DockPanel HorizontalAlignment="Stretch"></DockPanel>
- </ItemsPanelTemplate>
- </Menu.ItemsPanel>
- <MenuItem Header="FILE"></MenuItem>
- <MenuItem Header="EDIT"></MenuItem>
- <MenuItem Header="VIEW"></MenuItem>
- <MenuItem Header="PROJECT"></MenuItem>
- <MenuItem Header="HELP" HorizontalAlignment="Right"></MenuItem>
- </Menu>
- </Grid>
- </Window>