Logo
My Account |  Site Map | Contact Us  
 The same content in Microsoft HTML help file format is included in the download package.
Checkable Item

A MenuItem can be checked or unchecked like a checkbox. To enable this feature, set the IsCheckable to true. The following XAML demonstrates this feature:

XAML
<Window x:Class="Test.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:eo="http://schemas.essentialobjects.com/wpf/"
        Title="MainWindow" Height="250" Width="350">
    <StackPanel>
        <eo:Menu IsMainMenu="True">
            <eo:MenuItem Header="_File" />
            <eo:MenuItem Header="_Edit" />
            <eo:MenuItem Header="_View">
                <eo:MenuItem Header="_Tool Bar" IsCheckable="True" IsChecked="True"></eo:MenuItem>
                <eo:MenuItem Header="_Status Bar" IsCheckable="True"></eo:MenuItem>
            </eo:MenuItem>
            <eo:MenuItem Header="_Window" />
            <eo:MenuItem Header="_Help" />
        </eo:Menu>
    </StackPanel>
</Window>

The above code produces the following result:

You can also group multiple checkable items together in a single group by setting their CheckGroup to the same value. When multiple checkable items are grouped together, checking any item in the group automatically uncheck all other checked items.


Direct link to this topic