# Checkable Menu Items

## Content



You can make any C1MenuItem a checkable menu item by setting its [IsCheckable](/componentone/api/wpf/online-menu5/dotnet-api/C1.WPF.Menu/C1.WPF.Menu.C1MenuItem.IsCheckable.html) property to True. The value of the [IsChecked](/componentone/api/wpf/online-menu5/dotnet-api/C1.WPF.Menu/C1.WPF.Menu.C1MenuItem.IsChecked.html) property determines whether or not the menu item is checked or unchecked. By default, the **IsChecked** property of an item is False. When the item is clicked, the value of the **IsChecked** property sets to True.

You can create a group of mutually exclusive checkable items by setting the [GroupName](/componentone/api/wpf/online-menu5/dotnet-api/C1.WPF.Menu/C1.WPF.Menu.C1MenuItem.GroupName.html) property of each item you wish to add to the group. For example, the XAML below will create a group of three mutually exclusive checkable items.

```xml
<c1:C1MenuItem Header="MenuItem1" IsCheckable="True" GroupName="MutuallyExclusiveGroup"/>
<c1:C1MenuItem Header="MenuItem2" IsCheckable="True" GroupName="MutuallyExclusiveGroup"/>
<c1:C1MenuItem Header="MenuItem3" IsCheckable="True" GroupName="MutuallyExclusiveGroup"/>
```

To create checkable menu items, use one of the following methods:

### In XAML

Complete the following steps:

1.  Locate the **<c1:C1MenuItem>** tag for the menu item you wish to make checkable and then add **IsCheckable="True"** to the tag so that the XAML resembles the following:

```xml
<c1:C1MenuItem Header="C1MenuItem" IsCheckable="True"/>
```

Optional: If you want the item to be checked at run time, you can also add **IsChecked="False"** to the tag.

2.  Run the project.

### In Code

Complete the following steps:

1.  In Source view, locate the **<c1:C1MenuItem>** tag for the item you wish to make checkable and add **x:Name="CheckableMenuItem"** to it. This will give the item a unique identifier that you can use in code.
2.  Enter Code view and add the following code beneath the **InitializeComponent()** method:

```vbnet
CheckableMenuItem.IsCheckable = True
```

```csharp
CheckableMenuItem.IsCheckable = true;
```

Optional: If you want the item to be checked at run time, you can add the following code to the project:

```vbnet
CheckableMenuItem.IsChecked = True
```

```csharp
CheckableMenuItem.IsChecked = true;
```

3.  Run the program.

### At Design Time

Complete the following steps:

1.  In Source view, select the **C1MenuItem** that you wish to make checkable.
2.  In the **Properties** window, select the **IsCheckable** check box to set the **IsCheckable** property to **True**. This makes the item checkable at run time.

Optional: If you want the item to be checked at run time, you can also select the **IsChecked** check box, but doing so isn't necessary to make an item checkable.

3.  Run the project.

## See Also

[Creating Menus](/componentone/docs/wpf/online-menu5/overview/flat-menu/CreatingMenus)

[Mutually Exclusive Checkable Menu Items](/componentone/docs/wpf/online-menu5/overview/flat-menu/CheckableMenuItems/MutuallyExclusiveCheckableMenuItems)