# Automatic Closing

## Content



By default, the menu, its submenus, and the submenus of a C1Menu control remains open even when a user clicks outside of the menu. The only way users can close the menu is by clicking the **C1Menu** control. However, you can change this behavior by enabling the automatic closing feature, which will allow users to close menus by clicking outside of the menu control's boundaries. To turn on automatic closing, set the **AutoClose** property to **True**.

To enable automatic closing, use one of the following methods:

### In XAML

Complete the following steps:

1.  Add **AutoClose="True"** to the **<c1:C1Menu>** or the **<c1:C1ContextMenu>** tag.
2.  Run the program.

### 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="C1Menu1"** 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
C1Menu1.AutoClose = True
```

```csharp
C1Menu1.AutoClose = true;
```

3.  Run the program.

### At Design Time

Complete the following steps:

1.  Select the **C1Menu** control.

The control's properties will appear in the **Properties** window.

2.  Select the **AutoClose** check box.
3.  Run the program.