I have a scenario where updating the View from the ViewModel using the INotifyPropertyChanged
interface is not suitable.
Instead I'd like to refresh some of the bindings explicitly.
In WPF this seems to be possible by obtaining a BindingExpression
from the control and call BindingExpression.UpdateTarget()
(see How to force a WPF binding to refresh?).
Is something similar possible in MAUI? BindingExpression
does not even seem to exist...
Background
I'm displaying a list of items, each of them has a CreatedAt
timestamp. In the UI I want to display this as "7 minutes ago", for example. Therefore I created a value converter that converts a DateTime
to a string. And of course the displayed string should update over time.
IMHO, updating the text in the UI should be a matter of the View in this case. I don't want to have an interval timer in my ViewModels. I prefer to have an interval timer in my View (in the code behind) that refreshes the binding of only those items currently visible.