Reputation: 33
Typical customer invoice scenario:
ObservableCollection in a viewmodel that holds LineItems. The view lists the LineItems with a calculated LineTotal shown at the end of each line. The, there's a GrandTotal shown at the bottom of the page.
If the user makes a change to Qty, to update other items on the page, I use an EventToCommand trigger on a TextBox that is bound to the Qty. When the command is invoked, I manually recalculate line totals and invoice totals to reflect changes.
Is there a better way to reflect changes made by the user to the Qty boxes? A way to force "rebinding" to refresh the page? Is there anything in Fody or Catel that handles this?
Upvotes: 0
Views: 84
Reputation: 33
Got It! I still use the EventtoCommand to fire a command in the viewmodel which calls base.RaisePropertyChanged("CurrentInvoice"). Then, anything bound to CurrentInvoice will be refreshed.
If there are nested viewmodels, send a message to the level of the property and then call base.RaisePropertyChanged("PropertyName").
Upvotes: 1