Menu Overview / Flat Menu / Creating Menus
Creating Menus

Using Menu for WPF, you can create a menu with submenu and context menu. The following sections will guide you through the steps to create a complete menu.

Creating a Top-Level Menu

  1. Add a C1Menu to your application.
  2. Place the following XAML between the <c1:C1Menu> and </c1:C1Menu> tags.
XAML
Copy Code
<c1:C1MenuItem Header="MenuItem1" Height="Auto" Width="Auto"/>
<c1:C1MenuItem Header="MenuItem2" Height="Auto" Width="Auto"/>
<c1:C1MenuItem Header="MenuItem3" Height="Auto" Width="Auto"/>
  1. Add Height="Auto" and Width="Auto" to the <c1:C1Menu> tag.
  2. Run the program and observe that a menu bar with three items appears.

Creating a Submenu

In this topic, you will create a submenu that's attached to one of a menu's items. This topic assumes that you have created a top-level menu with at least one menu item.

  1. Place the following XAML between the <c1:C1Menu> and </c1:C1Menu> tags.
XAML
Copy Code
<c1:C1MenuItem Header="Click here" Height="Auto" Width="Auto">
     <c1:C1MenuItem Header="Submenu Item" Height="Auto" Width="Auto"/>
     <c1:C1MenuItem Header="Submenu Item" Height="Auto" Width="Auto"/>
     <c1:C1MenuItem Header="Submenu Item" Height="Auto" Width="Auto"/>
</c1:C1MenuItem>
  1. Add Height="Auto" and Width="Auto" to the <c1:C1Menu> tag.
  1. Run the program and click the Click here menu item. Observe that a submenu with three items appears.