top of page

Wpf Dialogs -

private readonly IDialogService _dialogService; public ICommand SaveCommand get; public ICommand EditItemCommand get;

if (saveFileDialog.ShowDialog() == true)

if (result == MessageBoxResult.Yes)

public string UserName get; private set; public MyDialog()

// Generic dialog window public partial class GenericDialog<T> : Window WPF Dialogs

For proper MVVM separation, avoid code-behind: Interface for Dialog Service public interface IDialogService

_dialogService = dialogService; SaveCommand = new RelayCommand(_ => Save()); EditItemCommand = new RelayCommand(_ => EditItem()); private readonly IDialogService _dialogService

if (dialog.ShowDialog() == DialogResult.OK)

bottom of page