Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandBinding"/> class.
        /// </summary>
        /// <param name="command">The command that is being bound.</param>
        /// <param name="executed">The handler for the command's <see cref="Executed"/> event.</param>
        /// <param name="canExecute">The handler for the command's <see cref="CanExecute"/> event.</param>
        public CommandBinding(ICommand command, UpfExecutedRoutedEventHandler executed, UpfCanExecuteRoutedEventHandler canExecute)
        {
            Contract.Require(command, nameof(command));

            this.command = command;

            if (executed != null)
            {
                Executed += executed;
            }

            if (canExecute != null)
            {
                CanExecute += canExecute;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandBinding"/> class.
 /// </summary>
 /// <param name="command">The command that is being bound.</param>
 /// <param name="executed">The handler for the command's <see cref="Executed"/> event.</param>
 public CommandBinding(ICommand command, UpfExecutedRoutedEventHandler executed)
     : this(command, executed, null)
 {
 }