/// <summary> /// Returns whether this converter can convert the object to the specified type, using the /// specified context. /// </summary> /// <param name="context"> /// An <see cref="ITypeDescriptorContext"/> that provides a format context. /// </param> /// <param name="destinationType"> /// A <see cref="Type"/> that represents the type you want to convert to. /// </param> /// <returns> /// <see langword="true"/> if this converter can perform the conversion; otherwise, /// <see langword="false"/>. /// </returns> public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(string)) { if (context != null && context.Instance != null) { MultiKeyGesture instance = context.Instance as MultiKeyGesture; if (instance != null) { if (!ModifierKeysConverter.IsDefinedModifierKeys(instance.Modifiers)) { return(false); } foreach (Key key in instance.Keys) { if (!IsDefinedKey(key)) { return(false); } } return(true); } } else { return(true); } } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="MultiKeyBinding"/> class. /// </summary> /// <param name="command">The command.</param> /// <param name="gesture">The multi-key gesture.</param> public MultiKeyBinding(ICommand command, MultiKeyGesture gesture) : base(command, gesture) { }