private void CellEditEnding(DataGridCellEditEndingEventArgs e) { var columnDisplayIndex = (DataGridColumns)e.Column.DisplayIndex; if (DataGridSelectedItem is Transaction selectedTransaction) { if (columnDisplayIndex == DataGridColumns.MoneySourceField) { if (!SourceItems.Contains(selectedTransaction.MoneySource)) { SourceItems.Add(selectedTransaction.MoneySource); } } } }
private void LoadBase() { var baseItems = db.GetItems(); ExpensesItems.Clear(); foreach (var transaction in baseItems) { ExpensesItems.Add(transaction); if (!SourceItems.Contains(transaction.MoneySource)) { SourceItems.Add(transaction.MoneySource); } } RaisePropertyChanged(nameof(ExpensesItems)); }