public void LoadDebtOfPerson(Person person) { DataGridDebts.ItemsSource = database.GetDebtsOfPerson(person); if (DataGridDebts.Items.Count > 0) { DataGridDebts.SelectedItem = DataGridDebts.Items[0]; AddDebtView.FillUpDebt(DataGridDebts.Items[0] as Debt); } }
private void DataGridDebts_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (DataGridDebts.SelectedItem != null) { var debt = (DataGridDebts.SelectedItem as Debt); if (debt == null) { return; } AddDebtView.FillUpDebt(debt); } }