private void BorderOff_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (State) { State = false; OffCommand?.Execute(CommandParameter); } }
private void ExecuteOnOffCommands() { // Make sure to raise the right command, depending on the IsOn state. // Also ensure that each command is executable. if (IsOn && OnCommand != null && OnCommand.CanExecute(OnCommandParameter)) { this.TraceVerbose("Executing OnCommand."); OnCommand.Execute(OnCommandParameter); } if (!IsOn && OffCommand != null && OffCommand.CanExecute(OffCommandParameter)) { this.TraceVerbose("Executing OffCommand."); OffCommand.Execute(OffCommandParameter); } }