From 9ec94dc29d89e847dcf56dee90add53ad7fb2a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wies=C5=82aw=20=C5=A0olt=C3=A9s?= Date: Tue, 15 Mar 2016 20:44:06 +0100 Subject: [PATCH] Added CommandParameter property for KeyBinding --- src/Perspex.Input/KeyBinding.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Perspex.Input/KeyBinding.cs b/src/Perspex.Input/KeyBinding.cs index 108690e6ef..0757922932 100644 --- a/src/Perspex.Input/KeyBinding.cs +++ b/src/Perspex.Input/KeyBinding.cs @@ -18,6 +18,15 @@ namespace Perspex.Input set { SetValue(CommandProperty, value); } } + public static readonly StyledProperty CommandParameterProperty = + PerspexProperty.Register("CommandParameter"); + + public object CommandParameter + { + get { return GetValue(CommandParameterProperty); } + set { SetValue(CommandParameterProperty, value); } + } + public static readonly StyledProperty GestureProperty = PerspexProperty.Register("Gesture"); @@ -32,8 +41,8 @@ namespace Perspex.Input if (Gesture?.Matches(args) == true) { args.Handled = true; - if (Command?.CanExecute(null) == true) - Command.Execute(null); + if (Command?.CanExecute(CommandParameter) == true) + Command.Execute(CommandParameter); } } }