Skip to main content

BarItem.Command Property

Gets or sets the command to invoke when the bar item is clicked. This is a dependency property.

Namespace: DevExpress.Xpf.Bars

Assembly: DevExpress.Xpf.Core.v23.2.dll

NuGet Package: DevExpress.Wpf.Core


public ICommand Command { get; set; }

Property Value

Type Description

The command to invoke when the bar item is clicked.


When invoking the bar item’s functionality, the command is executed first. Then, the BarItem.ItemClick and BarManager.ItemClick events fire.

Use the BarItem.BeforeCommandExecute property to perform actions immediately after an end-user has clicked the button before the Command is executed.


This example shows how to specify a command and custom short cut for a bar item. A command and short cut are assigned to the item via the Command and KeyGesture properties, respectively. In the example, a bar is docked to the BarContainerControl which is created manually.

    <dxb:BarButtonItem Name="btnCut" 
                       CommandTarget="{Binding ElementName=textBox}" 
                       Content="{Binding Command.Text, RelativeSource={RelativeSource Self}}"/>

The following code snippets (auto-collected from DevExpress Examples) contain references to the Command property.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also