using System.Windows.Forms; // Add reference to System.Windows.Forms var dialog = new FolderBrowserDialog
public partial class MyDialog : Window
_dialogService = dialogService; SaveCommand = new RelayCommand(_ => Save()); EditItemCommand = new RelayCommand(_ => EditItem());
// Save logic
return MessageBox.Show(message, title, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;
var windowType = GetWindowTypeForViewModel(viewModel.GetType()); var window = (Window)Activator.CreateInstance(windowType); window.DataContext = viewModel; window.Owner = Application.Current.MainWindow; return window.ShowDialog() == true ? (T)viewModel : null;
bool ShowConfirmation(string message, string title); string ShowInputDialog(string prompt, string defaultText = ""); T ShowDialog<T>(object viewModel) where T : class;
Filter = "Text files (*.txt); if (openFileDialog.ShowDialog() == true)