Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode

Dialogs - Wpf

using System.Windows.Forms; // Add reference to System.Windows.Forms var dialog = new FolderBrowserDialog

await DialogManager.ShowMessageAsync(this, "Success", "Operation completed!"); var result = await DialogManager.ShowInputAsync(this, "Input", "Enter value:"); | Dialog Type | Method | Modal | Return Value | |------------|--------|-------|---------------| | MessageBox | MessageBox.Show() | Yes | MessageBoxResult | | Custom | ShowDialog() | Yes | bool? | | File Open | OpenFileDialog.ShowDialog() | Yes | bool? | | File Save | SaveFileDialog.ShowDialog() | Yes | bool? | | Folder Browser | FolderBrowserDialog.ShowDialog() | Yes | DialogResult |

private Type GetWindowTypeForViewModel(Type viewModelType) WPF Dialogs

// Usage with async operation async Task ProcessDataAsync()

public partial class MyDialog : Window

private void Save()

if (result == MessageBoxResult.Yes)

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