Пример #1
0
        private void BudgetItemChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            e.NewItems?.Cast <BudgetItem>().ToList().ForEach(item =>
            {
                var viewModel = new BudgetItemViewModel(item);
                BudgetItems.Add(viewModel);
            });

            e.OldItems?.Cast <BudgetItem>().ToList().ForEach(item => BudgetItems.Remove(FindMatchingViewModel(item)));
        }
Пример #2
0
 public BudgetGroupViewModel(BudgetGroup budgetGroup)
 {
     BudgetGroup  = budgetGroup;
     presentation = new BudgetGroupPresentation();
     budgetGroup.BudgetItems.CollectionChanged += BudgetItemChanged;
     budgetGroup.BudgetItems.ToList().ForEach(item =>
     {
         var viewModel = new BudgetItemViewModel(item);
         BudgetItems.Add(viewModel);
     });
     budgetGroup.PropertyChanged += (o, e) => PropertyChanged?.Invoke(this, e);
 }
Пример #3
0
        private void AddBudgetItemViewModel(BudgetItem item)
        {
            var itemViewModel = new BudgetItemViewModel(item);

            BudgetItems.Add(itemViewModel);
        }