private void EditItem()

private Type GetWindowTypeForViewModel(Type viewModelType)

Filter = "PDF files ( .pdf);

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;

var dialog = new MyDialog(); if (dialog.ShowDialog() == true)