You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering if some feature like this could be done:
class Item
{
[ObservableProperty]
public decimal Quantity { get; set; }
[ObservableProperty]
public decimal Price { get; set; }
}
class Invoice
{
[ObservableProperty]
public ObservableCollection<Item> Items { get; set; }
[ObservableProperty]
[DependsOn("Items->Quantity")]
[DependsOn("Items->Price")]
public decimal Total => Items.Sum(i => i.Quantity * i.Price);
}
It would do for us the work of subscribing to each Item's PropertyChanged event and rising OnPropertyChanged for the calculated property on the "parent" view model.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!
I'm wondering if some feature like this could be done:
It would do for us the work of subscribing to each Item's PropertyChanged event and rising OnPropertyChanged for the calculated property on the "parent" view model.
Beta Was this translation helpful? Give feedback.
All reactions