Back to Devexpress

BackstageButtonItem.Command Property

wpf-devexpress-dot-xpf-dot-ribbon-dot-backstagebuttonitem.md

latest2.4 KB
Original Source

BackstageButtonItem.Command Property

Gets or sets a command fired when the button item is clicked.

Namespace : DevExpress.Xpf.Ribbon

Assembly : DevExpress.Xpf.Ribbon.v25.2.dll

NuGet Package : DevExpress.Wpf.Ribbon

Declaration

csharp
public ICommand Command { get; set; }
vb
Public Property Command As ICommand

Property Value

TypeDescription
ICommand

A ICommand object, fired when the button item is clicked.

|

Remarks

You can define an action that will happen when the BackstageButtonItem is clicked by setting the Command property. The command must be defined in Window.CommandBindings section in order to make it reusable for different controls. If the Command is a RoutedCommand , you may want to define the BackstageButtonItem.CommandTarget.

The following code shows an example of binding a predefined Paste command to a button:

xaml
<dxr:BackstageButtonItem Name ="pasteButton" Content="Paste" Command="ApplicationCommands.Paste" CommandTarget="{Binding ElementName=textBox2}" />
csharp
pasteButton.Command = ApplicationCommands.Paste;
pasteButton.CommandTarget = textBox2;

To learn more about commands, see the Commanding Overview and ICommand Interface articles in MSDN.

You can also implement an action for a button via the BackstageItemBase.Click event.

See Also

CommandTarget

Click

BackstageButtonItem Class

BackstageButtonItem Members

DevExpress.Xpf.Ribbon Namespace