ButtonBase.Command Property

Definition

Gets or sets the command to invoke when this button is pressed.

C#
[System.ComponentModel.Bindable(true)]
[System.Windows.Localizability(System.Windows.LocalizationCategory.NeverLocalize)]
public System.Windows.Input.ICommand Command { get; set; }

Property Value

A command to invoke when this button is pressed. The default value is null.

Attributes

Remarks

This property is used to associate a command with a particular button instance.

In Extensible Application Markup Language (XAML), this property is most often set to be a static command value from one of the existing command libraries, such as ApplicationCommands or NavigationCommands. For details, see Commanding Overview or ICommand.

XAML Attribute Usage

<object Command="commandName"/>

XAML Values

commandName The command to invoke when this button is pressed.

Dependency Property Information

Item Value
Identifier field CommandProperty
Metadata properties set to true None

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10