Skip to main content
Bar

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BarItem.CommandTarget Property

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.v24.2.dll

NuGet Package: DevExpress.Wpf.Core

#Declaration

[Bindable(true)]
public IInputElement CommandTarget { get; set; }

#Property Value

Type Description
IInputElement

The element on which to raise the BarItem.Command.

#Example

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>
See Also