private void BtnEdit_Click(object sender, RoutedEventArgs e) { EditPrescriptionDialog = new EditPrescriptionDialog(); EditPrescriptionDialog.Parent = this; PrescriptionItem MyItem = new PrescriptionItem(); Button btn = sender as Button; foreach (var item in PrescriptionList) { if (item.Id == btn.Tag.ToString()) { MyItem = item; break; } } EditPrescriptionView child = new EditPrescriptionView(MyItem); child.Close += new EventHandler(child_Close); for (int i = 0; i < PrescriptionList.Count; i++) { PrescriptionItem item = PrescriptionList[i]; if (item.Id == btn.Tag.ToString()) { PrescriptionList[i] = MyItem; break; } } EditPrescriptionDialog.Content = child; EditPrescriptionDialog.Show(); }
public EditPrescriptionView(PrescriptionItem MyItem) { InitializeComponent(); MyChangeItem = MyItem; }