using System; using System.Windows.Input; using System.Windows.Markup; namespace Caliburn.MarkupExtensions { public class GestureExtension : MarkupExtension { private Key _key = Key.None; private ModifierKeys _modifiers = ModifierKeys.None; private MouseAction _mouseAction = MouseAction.None; public Key Key { get { return _key; } set { _key = value; } } public ModifierKeys Modifiers { get { return _modifiers; } set { _modifiers = value; } } public MouseAction MouseAction { get { return _mouseAction; } set { _mouseAction = value; } } public override object ProvideValue(IServiceProvider serviceProvider) { if(_key != Key.None) return new KeyGesture(_key, _modifiers); else return new MouseGesture(_mouseAction, _modifiers); } } }