private void btnEditImage_Click(object sender, RoutedEventArgs e) { if (SelectedDataGridItem != null) { ImageModel doppleganger = new ImageModel(); doppleganger.CopyFrom(SelectedDataGridItem); AddEditWindow addModifyWindow = new AddEditWindow(doppleganger); if (addModifyWindow.ShowDialog() ?? false) { SelectedDataGridItem.CopyFrom(doppleganger); } } }
private void btnNewImage_Click(object sender, RoutedEventArgs e) { ImageModel blankImageInfo = new ImageModel(); AddEditWindow addModifyWindow = new AddEditWindow(blankImageInfo); if (addModifyWindow.ShowDialog() ?? false) { Images.Add(blankImageInfo); DataGridSource = Images; ClearDataGridSearch(); // Set the newly added ImageModel to the Selected Image in the Data Grid dataGridImageCollection.SelectedIndex = DataGridSource.Count - 1; } }