private void EditReadout(object sender, RoutedEventArgs e) { /* * find selected row, get ID from first column (hidden column "ID") * send "self" that "update" function could be called from another window * send ID to the Editing window, open it; * Function in the editing window loads data based on ID */ for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual) { if (vis is DataGridRow) { var row = (DataGridRow)vis; int id = Convert.ToInt32((tbl_Readouts.SelectedCells[0].Column.GetCellContent(row) as TextBlock).Text); ManageReadout manageReadout = new ManageReadout(this, id, 0); manageReadout.Show(); } } } // edit meter
public void OpenWindowAddReadout(int ID_readout, int ID_meter) { ManageReadout manageReadout = new ManageReadout(this, ID_readout, ID_meter); manageReadout.Show(); }