private void ItemCreate_Click(object sender, RoutedEventArgs e) { AddItem addItem = new AddItem(); //create your new form. addItem.Show(); //show the new form. this.Close(); }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { object item = dataGridView.SelectedItem; string setValueForTxtId = (dataGridView.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; string setValueForTxtName = (dataGridView.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text; string setValueForTxtDescription = (dataGridView.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text; string setValueForTxtPrice = (dataGridView.SelectedCells[3].Column.GetCellContent(item) as TextBlock).Text; AddItem ec = new AddItem(setValueForTxtId, setValueForTxtName, setValueForTxtDescription, setValueForTxtPrice); ec.Show(); this.Close(); }