void OnCloseCommand() { // ダサいけど、IsClosingAcceptedがtrueなら~の分岐がView側にあるので仕方ない if (IsClosingAccepted) { ForceCloseCommand.Execute(null); } else { QueryClosingCommand.Execute(null); } }
private void AssociatedObject_Closing(object sender, CancelEventArgs e) { if (QueryClosingCommand == null || !QueryClosingCommand.CanExecute(null)) { return; } if (!IsClosingAccepted) { e.Cancel = true; this.Dispatcher.BeginInvoke(new Action(() => { // 出直してきて QueryClosingCommand.Execute(null); })); } }