How to add a Separator to a Menu in WPF

A separate is used to separate categories of menu items. We can add a separator to a menu control by using <Separator /> tag. 

We can also ass sub menus and sub menu items using the MenuItem tag within parent a MenuItem tag. The following code adds a separator and sub menus and sub menu items to the menu.


<MenuItem Header="Sub Items">

    <MenuItem Header="Child1 SubItem" IsCheckable="true"/>

    <MenuItem Header="Child2 SubItem" IsCheckable="true">

        <MenuItem Header="GrandChild2 SubItem" IsCheckable="true"/>