private void BtnModifyProduct_Click(object sender, RoutedEventArgs e) { selectedIndex = DataGridProducts.SelectedIndex; if (selectedIndex != -1) { selectedProduct = productList[selectedIndex]; //message to verify edit string msg = "Are you sure you want to edit: " + selectedProduct.ProductName + "?"; MessageBoxResult boxResult = MessageBox.Show(msg, "Accept Modify", MessageBoxButton.YesNo, MessageBoxImage.Question); if (boxResult == MessageBoxResult.Yes) { Window WindowProdAdd = new ProductAdd(selectedProduct); WindowProdAdd.Show(); Close(); } } }