// https://stackoverflow.com/questions/22790181/wpf-datagrid-row-double-click-event-programmatically void dgPatterns_RowDoubleClick(object sender, MouseButtonEventArgs e) { dgPatterns.CancelEdit(); // https://stackoverflow.com/questions/16236905/access-parent-window-from-user-control var dlg = new PatternsDetailDlg(Window.GetWindow(this), vm, (MPattern)((DataGridRow)sender).Item); dlg.ShowDialog(); }
void btnAddPattern_Click(object sender, RoutedEventArgs e) { var dlg = new PatternsDetailDlg(Window.GetWindow(this), vm, vm.NewPattern()); dlg.ShowDialog(); }