ChocoPM.Commands.DataContextCommandBinding.OnCanExecute C# (CSharp) Method

OnCanExecute() protected method

The method that is called when the CanExecute RoutedEvent for the ICommand associated with this DataContextCommandBinding should be handled.
protected OnCanExecute ( object sender, System.Windows.Input.CanExecuteRoutedEventArgs e ) : void
sender object The command target on which the command is executing.
e System.Windows.Input.CanExecuteRoutedEventArgs The event data.
return void
        protected internal override void OnCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            var target = GetDataContext(sender);
            bool canExecute;
            if (!CommandExecutionManager.TryExecuteCommand(target, e.Parameter, false, Executed,
                    CanExecute, out canExecute))
            {
                return;
            }

            e.CanExecute = canExecute;
            e.Handled = true;
        }