O friend, we are with you

Wherever you go

Dialogs | Wpf

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

// Convention: MainViewModel -> MainWindow string viewName = viewModelType.Name.Replace("ViewModel", "Window"); return Type.GetType($"MyApp.Views.viewName");

public string ShowInputDialog(string prompt, string defaultText = "")

if (saveFileDialog.ShowDialog() == true) WPF Dialogs

var progressDialog = new ProgressDialog("Processing..."); progressDialog.Show();

private void EditItem()

public MainViewModel(IDialogService dialogService) _dialogService = dialogService

UserName = NameTextBox.Text; DialogResult = true; Close();

DialogResult = false; Close();

// Save File Dialog var saveFileDialog = new Microsoft.Win32.SaveFileDialog .docx", DefaultExt = ".pdf", FileName = "document" ; SaveCommand = new RelayCommand(_ =&gt

Dispatcher.Invoke(() => ProgressBar.Value = (double)current / total * 100; MessageText.Text = message; );

private Type GetWindowTypeForViewModel(Type viewModelType)

for (int i = 0; i < 100; i++)

MessageBox The simplest dialog for alerts and confirmations:

public bool Confirmed get; set; public T Data get; set;

Scroll to Top