# ContextMenu

Namespace: **Wisej.Web**

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

* [Component](https://docs.wisej.com/api/wisej.base/general/wisej.base.component)
  * [Component](https://docs.wisej.com/api/wisej.web/general/wisej.web.component)
    * [BindableComponent](https://docs.wisej.com/api/wisej.web/general/wisej.web.bindablecomponent)
      * [Menu](https://docs.wisej.com/api/wisej.web/menus/wisej.web.menu)
        * [ContextMenu](https://docs.wisej.com/api/wisej.web/menus/wisej.web.contextmenu)

Represents a context menu associated to a [Control](https://docs.wisej.com/api/wisej.web/general/control).

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

```csharp
public class ContextMenu : Menu
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Constructors

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ContextMenu()

Initializes a new instance of the [ContextMenu](https://docs.wisej.com/api/wisej.web/menus/wisej.web.contextmenu) class with no menu items specified.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ContextMenu(menuItems)

Initializes a new instance of the [ContextMenu](https://docs.wisej.com/api/wisej.web/menus/wisej.web.contextmenu) class with a specified set of [MenuItem](https://docs.wisej.com/api/wisej.web/menus/wisej.web.menuitem) objects.

| Name          | Type                                                                          | Description                                                                                                                                              |
| ------------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **menuItems** | [MenuItem\[\]](https://docs.wisej.com/api/wisej.web/menus/wisej.web.menuitem) | An array of [MenuItem](https://docs.wisej.com/api/wisej.web/menus/wisej.web.menuitem) objects that represent the menu items to add to the shortcut menu. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ContextMenu(container)

Initializes a new instance of the [ToolTip](https://docs.wisej.com/api/wisej.web/extenders/wisej.web.tooltip) class with a specified container.

| Name          | Type                                                                                 | Description                                                                                                                                                                                                        |
| ------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **container** | [IContainer](https://docs.microsoft.com/dotnet/api/system.componentmodel.icontainer) | An [IContainer](https://docs.microsoft.com/dotnet/api/system.componentmodel.icontainer) that represents the container of the [ToolTip](https://docs.wisej.com/api/wisej.web/extenders/wisej.web.tooltip) extender. |

## Properties

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) RightToLeft

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SourceComponent

[IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent): Returns the component that is displaying the shortcut menu.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SourceControl

[Control](https://docs.wisej.com/api/wisej.web/general/control): Returns the control that is displaying the shortcut menu.

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) Dispose(disposing)

Disposes of the resources, other than memory, used by the [ContextMenu](https://docs.wisej.com/api/wisej.web/menus/wisej.web.contextmenu).

| Parameter     | Type                                                            | Description                                                                 |
| ------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------- |
| **disposing** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true when this method is called by the application rather than a finalizer. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnCollapse(e)

Fires the [Collapse](#collapse) event.

| Parameter | Type                                                                | Description                                                                                          |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnLoad(e)

Fires the [Load](#load) event.

| Parameter | Type                                                                | Description                                                                                          |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnMenuItemAdded(e)

Fires the [MenuItemAdded](https://docs.wisej.com/api/wisej.web/wisej.web.menu#menuitemadded) event.

| Parameter | Type                                                                                        | Description                                                                                                                 |
| --------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [MenuItemEventArgs](https://docs.wisej.com/api/wisej.web/menus/wisej.web.menuitemeventargs) | A [MenuItemEventArgs](https://docs.wisej.com/api/wisej.web/menus/wisej.web.menuitemeventargs) that contains the event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnMenuItemRemoved(e)

Fires the [MenuItemRemoved](https://docs.wisej.com/api/wisej.web/wisej.web.menu#menuitemremoved) event.

| Parameter | Type                                                                                        | Description                                                                                                                 |
| --------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [MenuItemEventArgs](https://docs.wisej.com/api/wisej.web/menus/wisej.web.menuitemeventargs) | A [MenuItemEventArgs](https://docs.wisej.com/api/wisej.web/menus/wisej.web.menuitemeventargs) that contains the event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnPopup(e)

Fires the [Popup](#popup) event.

| Parameter | Type                                                                | Description                                                                                          |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnWebEvent(e)

Processes the event from the client.

| Parameter | Type                                                                           | Description      |
| --------- | ------------------------------------------------------------------------------ | ---------------- |
| **e**     | [WisejEventArgs](https://docs.wisej.com/api/wisej.core/general/wisejeventargs) | Event arguments. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnWebRender(config)

Renders the client component.

| Parameter  | Type                                                          | Description                   |
| ---------- | ------------------------------------------------------------- | ----------------------------- |
| **config** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic configuration object. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Show(component, position, onclose)

Displays the context menu at the specified position in relation to the specified component.

| Parameter                                                                                                                                                                                                                 | Type                                                                                           | Description                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **component**                                                                                                                                                                                                             | [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) | Can be any Wisej visual component: i.e. tool button, column header, etc.                                                                                           |
| **position**                                                                                                                                                                                                              | [Placement](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.placement)             | A [Placement](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.placement) that specifies position of the menu in relation to the *component* parameter. |
| **onclose** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<ContextMenu>](https://docs.microsoft.com/dotnet/api/system.action-1)                  | Optional async handler for the close event; called when the context menu has been closed. It's the equivalent of handling the [event.](#collapse)                  |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Show(pos, onclose)

Displays the context menu at the specified position.

| Parameter                                                                                                                                                                                                                 | Type                                                                          | Description                                                                                                                                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| **pos**                                                                                                                                                                                                                   | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)           | A [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point) that specifies the coordinates at which to display the menu.                |
| **onclose** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<ContextMenu>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional async handler for the close event; called when the context menu has been closed. It's the equivalent of handling the [event.](#collapse) |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Show(control, position, onclose)

Displays the context menu at the specified position in relation to the specified control.

| Parameter                                                                                                                                                                                                                 | Type                                                                               | Description                                                                                                                                                      |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **control**                                                                                                                                                                                                               | [Control](https://docs.wisej.com/api/wisej.web/general/control)                    | A [Control](https://docs.wisej.com/api/wisej.web/general/control) that specifies the control with which this shortcut menu is associated.                        |
| **position**                                                                                                                                                                                                              | [Placement](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.placement) | A [Placement](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.placement) that specifies position of the menu in relation to the *control* parameter. |
| **onclose** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<ContextMenu>](https://docs.microsoft.com/dotnet/api/system.action-1)      | Optional async handler for the close event; called when the context menu has been closed. It's the equivalent of handling the [event.](#collapse)                |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *control* parameter is null.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The control is not visible.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Show(control, pos, onclose)

Displays the context menu at the specified position in relation to the specified control.

| Parameter                                                                                                                                                                                                                 | Type                                                                          | Description                                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **control**                                                                                                                                                                                                               | [Control](https://docs.wisej.com/api/wisej.web/general/control)               | A [Control](https://docs.wisej.com/api/wisej.web/general/control) that specifies the control with which this shortcut menu is associated.                                                                                                                  |
| **pos**                                                                                                                                                                                                                   | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)           | A [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point) that specifies the coordinates at which to display the menu. These coordinates are specified relative to the client coordinates of the control specified in the *control* parameter. |
| **onclose** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<ContextMenu>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional async handler for the close event; called when the context menu has been closed. It's the equivalent of handling the [event.](#collapse)                                                                                                          |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *control* parameter is null.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The handle of the control does not exist or the control is not visible.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Show(control, pos, alignment, onclose)

Displays the context menu at the specified position and with the specified alignment in relation to the specified control.

| Parameter                                                                                                                                                                                                                 | Type                                                                                                 | Description                                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **control**                                                                                                                                                                                                               | [Control](https://docs.wisej.com/api/wisej.web/general/control)                                      | A [Control](https://docs.wisej.com/api/wisej.web/general/control) that specifies the control with which this shortcut menu is associated.                                                                                                                  |
| **pos**                                                                                                                                                                                                                   | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                                  | A [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point) that specifies the coordinates at which to display the menu. These coordinates are specified relative to the client coordinates of the control specified in the *control* parameter. |
| **alignment**                                                                                                                                                                                                             | [LeftRightAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.leftrightalignment) | A [LeftRightAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.leftrightalignment) that specifies the alignment of the control relative to the *pos* parameter.                                                                        |
| **onclose** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<ContextMenu>](https://docs.microsoft.com/dotnet/api/system.action-1)                        | Optional async handler for the close event; called when the context menu has been closed. It's the equivalent of handling the [event.](#collapse)                                                                                                          |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *control* parameter is null.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The control is not visible.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ShowAsync(component, position)

Asynchronously displays the context menu at the specified position in relation to the specified component.

| Parameter     | Type                                                                                           | Description                                                                                                                                                        |
| ------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **component** | [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) | Can be any Wisej visual component: i.e. tool button, column header, etc.                                                                                           |
| **position**  | [Placement](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.placement)             | A [Placement](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.placement) that specifies position of the menu in relation to the *component* parameter. |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ShowAsync(pos)

Asynchronously displays the context menu at the specified position.

| Parameter | Type                                                                | Description                                                                                                                        |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| **pos**   | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point) | A [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point) that specifies the coordinates at which to display the menu. |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ShowAsync(control, position)

Asynchronously displays the context menu at the specified position in relation to the specified control.

| Parameter    | Type                                                                               | Description                                                                                                                                                      |
| ------------ | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **control**  | [Control](https://docs.wisej.com/api/wisej.web/general/control)                    | A [Control](https://docs.wisej.com/api/wisej.web/general/control) that specifies the control with which this shortcut menu is associated.                        |
| **position** | [Placement](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.placement) | A [Placement](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.placement) that specifies position of the menu in relation to the *control* parameter. |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task).

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *control* parameter is null.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The control is not visible.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ShowAsync(control, pos)

Asynchronously displays the context menu at the specified position in relation to the specified control.

| Parameter   | Type                                                                | Description                                                                                                                                                                                                                                                |
| ----------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api/wisej.web/general/control)     | A [Control](https://docs.wisej.com/api/wisej.web/general/control) that specifies the control with which this shortcut menu is associated.                                                                                                                  |
| **pos**     | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point) | A [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point) that specifies the coordinates at which to display the menu. These coordinates are specified relative to the client coordinates of the control specified in the *control* parameter. |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task).

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *control* parameter is null.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The handle of the control does not exist or the control is not visible.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ShowAsync(control, pos, alignment)

Asynchronously displays the context menu at the specified position and with the specified alignment in relation to the specified control.

| Parameter     | Type                                                                                                 | Description                                                                                                                                                                                                                                                |
| ------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **control**   | [Control](https://docs.wisej.com/api/wisej.web/general/control)                                      | A [Control](https://docs.wisej.com/api/wisej.web/general/control) that specifies the control with which this shortcut menu is associated.                                                                                                                  |
| **pos**       | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                                  | A [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point) that specifies the coordinates at which to display the menu. These coordinates are specified relative to the client coordinates of the control specified in the *control* parameter. |
| **alignment** | [LeftRightAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.leftrightalignment) | A [LeftRightAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.leftrightalignment) that specifies the alignment of the control relative to the *pos* parameter.                                                                        |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task).

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *control* parameter is null.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The control is not visible.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Update()

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

## Events

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Collapse

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the context menu collapses.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Load

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Occurs before the context menu is displayed on the client when shown using one of the [Show](#show-component-position-onclose) or [ShowAsync](#showasync-component-position) methods. It doesn't fire when the context menu is associated to a control and it's shown from a user event (i.e. the user right clicks on the control associated with the context menu).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Popup

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Occurs after the context menu is displayed on the client.

## Implements

| Name                                                                                                 | Description                                                                                                     |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| [IUserData](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.iuserdata)                     | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface. |
| [IBindableComponent](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.ibindablecomponent) | Bindable components implement this interface.                                                                   |
| [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent)       | All wisej components implement this interface.                                                                  |
| [IWisejSerializable](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejserializable) | Allows an object to serialize itself.                                                                           |
