This documentation is archived and is not being maintained.

InputBinding.Command Property

Gets or sets the ICommand associated with this binding.

Namespace: System.Windows.Input
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

<LocalizabilityAttribute(LocalizationCategory.NeverLocalize)> _
<TypeConverterAttribute("System.Windows.Input.CommandConverter, PresentationFramework, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")> _
Public Property Command As ICommand
Dim instance As InputBinding
Dim value As ICommand

value = instance.Command

instance.Command = value
/** @property */
public final ICommand get_Command ()

/** @property */
public void set_Command (ICommand value)

public final function get Command () : ICommand

public function set Command (value : ICommand)

You cannot use this property in XAML.

Property Value

The command. There is no default value.

Exception typeCondition


the Command value is a null reference (Nothing in Visual Basic).

The following example shows how to use a KeyBinding to bind a KeyGesture to the ApplicationCommands.Open command. When the key gesture is performed, the open command is invoked.

  <KeyBinding Key="B"
              Command="ApplicationCommands.Open" />

KeyGesture OpenKeyGesture = new KeyGesture(

KeyBinding OpenCmdKeybinding = new KeyBinding(


Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0