wpf-devexpress-dot-xpf-dot-bars-dot-baritem-b8162ae3.md
Gets or sets the element on which to raise the BarItem.Command. This is a dependency property.
Namespace : DevExpress.Xpf.Bars
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
[Bindable(true)]
public IInputElement CommandTarget { get; set; }
<Bindable(True)>
Public Property CommandTarget As IInputElement
| Type | Description |
|---|---|
| IInputElement |
The element on which to raise the BarItem.Command.
|
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:BarManager.Items>
<dxb:BarButtonItem Name="btnCut"
Command="ApplicationCommands.Cut"
KeyGesture="CTRL+1"
CommandTarget="{Binding ElementName=textBox}"
Content="{Binding Command.Text, RelativeSource={RelativeSource Self}}"/>
</dxb:BarManager.Items>
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CommandTarget property.
Note
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.
Command="dxdo:MDIControllerCommand.ChangeMDIStyle"
CommandTarget="{Binding ElementName=dockManager}"
CommandParameter="{Binding ElementName=documentContainer}"
See Also