# MainMenu

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (2.5.0.0)

* [Component](https://docs.wisej.com/api/v2.5/wisej.base/general/wisej.base.component)
  * [Component](https://docs.wisej.com/api/v2.5/wisej.web/general/wisej.web.component)
    * [Menu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.menu)
      * [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu)

Represents the main menu in a [Form](#form).

{% tabs %}
{% tab title="C#" %}

```csharp
public class MainMenu : Menu
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class MainMenu
    Inherits Menu
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)MainMenu()

Initializes a new instance of the [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu) class without any specified menu items.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)MainMenu(container)

Initializes a new instance of the [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu) class with the specified container.

| Name          | Type                                                                                       | Description                                                                                                                                                                                                     |
| ------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **container** | [IContainer](https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.icontainer) | An [IContainer](https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.icontainer) representing the container of the [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu). |

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)MainMenu(items)

Initializes a new instance of the [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu) with a specified set of [MenuItem](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.menuitem) objects.

| Name      | Type                                                                               | Description                                                                                                                                                                                                  |
| --------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **items** | [MenuItem\[\]](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.menuitem) | An array of [MenuItem](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.menuitem) objects that will be added to the [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu). |

## Properties

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)AutoOverflow

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Enables the overflow handling which automatically removes items that don't fit in the [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu) and adds them to a drop-down button.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)BackColor

[Color](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.color): Returns or sets the background color of the main menu bar.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)CausesValidation

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Returns or sets whether clicking menu items causes validation to be performed on the active control.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Font

[Font](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.font): Returns or sets the font of the main menu bar.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)ForeColor

[Color](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.color): Returns or sets the text color of the main menu bar.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)RightToLeft

[RightToLeft](https://docs.wisej.com/api/v2.5/wisej.web/enumerations/wisej.web.righttoleft): Returns or sets whether the text displayed by the control is displayed from right to left.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Visible

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Returns or sets whether the menu is visible.

## Methods

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)CloneMenu()

Creates a new [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu) that is a duplicate of the current [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu).

**Returns:** [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu). A [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu) that represents the cloned menu.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)GetForm()

Returns the [Form](https://docs.wisej.com/api/v2.5/wisej.web/containers/form) that contains this menu.

**Returns:** [Form](https://docs.wisej.com/api/v2.5/wisej.web/containers/form). A [Form](https://docs.wisej.com/api/v2.5/wisej.web/containers/form) that is the container for this menu. Returns null if the [MainMenu](https://docs.wisej.com/api/v2.5/wisej.web/menus/wisej.web.mainmenu) is not currently hosted on a form.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Hide()

Hides the main menu.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Show()

Shows the main menu.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)Update()

Updates the component on the client. Overridden to update the owner form.

## Events

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)BackColorChanged

[EventHandler](https://docs.microsoft.com/en-us/dotnet/api/system.eventhandler) Fired when the [BackColor](#backcolor) property value changes.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)CausesValidationChanged

[EventHandler](https://docs.microsoft.com/en-us/dotnet/api/system.eventhandler) Fired when the value of the [CausesValidation](#causesvalidation) property changes.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)FontChanged

[EventHandler](https://docs.microsoft.com/en-us/dotnet/api/system.eventhandler) Fired when the [Font](#font) property value changes.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)ForeColorChanged

[EventHandler](https://docs.microsoft.com/en-us/dotnet/api/system.eventhandler) Fired when the [ForeColor](#forecolor) property value changes.

### ![](https://314832588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MTHCfAYyBPycFG90wsw-4198400543%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=060b281d-9363-48a1-a0f9-788ad1831e96)VisibleChanged

[EventHandler](https://docs.microsoft.com/en-us/dotnet/api/system.eventhandler) Fired when the [Visible](#visible) property value changes.

## Implements

| Name                                                                                                      | Description                                    |
| --------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| [IWisejComponent](https://docs.wisej.com/api/v2.5/wisej.core/interfaces/wisej.core.iwisejcomponent)       | All wisej components implement this interface. |
| [IWisejSerializable](https://docs.wisej.com/api/v2.5/wisej.core/interfaces/wisej.core.iwisejserializable) | Allows an object to serialize itself.          |
