# Command class

Namespace: [Eto.Forms](https://eto.picoe.ca/api/namespace/eto.forms.md) · Assembly: [Eto](https://eto.picoe.ca/api/assembly/eto.md)

```cs
public class Command : IBindable, ICommand
```

Base command for use on either [ToolBar](https://eto.picoe.ca/api/type/eto.forms.toolbar.md) or [MenuBar](https://eto.picoe.ca/api/type/eto.forms.menubar.md)

**Remarks:** Commands allow you to create a single class that can be used for both menu and tool items.

**Derived types:** [CheckCommand](https://eto.picoe.ca/api/type/eto.forms.checkcommand.md), [ValueCommand<T>](https://eto.picoe.ca/api/type/eto.forms.valuecommand-1.md)

## Constructors

- [Command](https://eto.picoe.ca/api/type/eto.forms.command/ctor.md): (2 overloads) Initializes a new instance of the [Command](https://eto.picoe.ca/api/type/eto.forms.command.md) class.

## Properties

- [Bindings](https://eto.picoe.ca/api/type/eto.forms.command/bindings.md): Gets the collection of bindings that are attached to this widget
- [CommandParameter](https://eto.picoe.ca/api/type/eto.forms.command/commandparameter.md): Gets or sets the parameter to pass to the [Command](https://eto.picoe.ca/api/type/eto.forms.command.md) when executing or determining its CanExecute state.
- [DataContext](https://eto.picoe.ca/api/type/eto.forms.command/datacontext.md): Gets or sets the data context for this widget for binding
- [DelegatedCommand](https://eto.picoe.ca/api/type/eto.forms.command/delegatedcommand.md): Gets or sets a command to delegate to when the command is invoked.
- [Enabled](https://eto.picoe.ca/api/type/eto.forms.command/enabled.md): Gets or sets a value indicating whether this [Command](https://eto.picoe.ca/api/type/eto.forms.command.md) is enabled.
- [ID](https://eto.picoe.ca/api/type/eto.forms.command/id.md): Gets or sets the ID of the command
- [Image](https://eto.picoe.ca/api/type/eto.forms.command/image.md): Gets or sets the image for the menu or tool item.
- [IsDataContextChanging](https://eto.picoe.ca/api/type/eto.forms.command/isdatacontextchanging.md): Gets a value indicating that the [Command.DataContext](https://eto.picoe.ca/api/type/eto.forms.command/datacontext.md) property is changing.
- [MenuText](https://eto.picoe.ca/api/type/eto.forms.command/menutext.md): Gets or sets the text when shown on the menu.
- [Parent](https://eto.picoe.ca/api/type/eto.forms.command/parent.md): Gets the parent widget which this widget has been added to, if any
- [Properties](https://eto.picoe.ca/api/type/eto.forms.command/properties.md): Gets the dictionary of properties for this widget
- [Shortcut](https://eto.picoe.ca/api/type/eto.forms.command/shortcut.md): Gets or sets the shortcut to trigger this command.
- [Tag](https://eto.picoe.ca/api/type/eto.forms.command/tag.md): Gets or sets a user-defined tag value for this instance.
- [ToolBarText](https://eto.picoe.ca/api/type/eto.forms.command/toolbartext.md): Gets or sets the tool bar text.
- [ToolTip](https://eto.picoe.ca/api/type/eto.forms.command/tooltip.md): Gets or sets the tool tip on both the menu and toolbar.

## Methods

- [CreateMenuItem](https://eto.picoe.ca/api/type/eto.forms.command/createmenuitem.md): Creates a new menu item attached to this command.
- [CreateToolItem](https://eto.picoe.ca/api/type/eto.forms.command/createtoolitem.md): Creates a new tool item attached to this command.
- [Execute](https://eto.picoe.ca/api/type/eto.forms.command/execute.md): Execute the command programatically.
- [OnDataContextChanged](https://eto.picoe.ca/api/type/eto.forms.command/ondatacontextchanged.md): Raises the [Command.DataContextChanged](https://eto.picoe.ca/api/type/eto.forms.command/datacontextchanged.md) event
- [OnEnabledChanged](https://eto.picoe.ca/api/type/eto.forms.command/onenabledchanged.md): Raises the [Command.EnabledChanged](https://eto.picoe.ca/api/type/eto.forms.command/enabledchanged.md) event.
- [OnExecuted](https://eto.picoe.ca/api/type/eto.forms.command/onexecuted.md): Raises the [Command.Executed](https://eto.picoe.ca/api/type/eto.forms.command/executed.md) event.
- [ICommand.CanExecute](https://eto.picoe.ca/api/type/eto.forms.command/system-windows-input-icommand-canexecute.md)
- [ICommand.Execute](https://eto.picoe.ca/api/type/eto.forms.command/system-windows-input-icommand-execute.md)

## Events

- [DataContextChanged](https://eto.picoe.ca/api/type/eto.forms.command/datacontextchanged.md): Event to handle when the [Command.DataContext](https://eto.picoe.ca/api/type/eto.forms.command/datacontext.md) has changed
- [EnabledChanged](https://eto.picoe.ca/api/type/eto.forms.command/enabledchanged.md): Occurs when the [Command.Enabled](https://eto.picoe.ca/api/type/eto.forms.command/enabled.md) property is changed.
- [Executed](https://eto.picoe.ca/api/type/eto.forms.command/executed.md): Occurs when the command is executed from either the menu or toolbar.
- [ICommand.CanExecuteChanged](https://eto.picoe.ca/api/type/eto.forms.command/system-windows-input-icommand-canexecutechanged.md)

## Convertors

- [operator implicit](https://eto.picoe.ca/api/type/eto.forms.command/op-implicit.md): (2 overloads, static) Implicitly converts the command to a menu item
