protected virtual async Task OnCloseDetailViewExecute() { if (HasChanges) { var result = await MessageDialogService.ShowOKCancelDialogAsync("You've made changes. Close this item?", "Question"); if (result == MessageDialogResult.Cancel) { return; } } EventAggregator.GetEvent <AfterDetailClosedEvent>().Publish(new AfterDetailClosedEventArgs { Id = Id, ViewModelName = GetType().Name }); }