c# - Wpf binding update regularly -
i've got complex back-end process runs long period of time. vital stats exposed properties inotifypropertychanged
events raised when they're set.
i wanted add "elapsed time" proving far more challenging anticipated.
i exposed processstartedat
datetime , threw converter subtract bound time datetime.now
. works (once). after that, since property isn't changing, binding never updated , converter isn't called again.
i don't want back-end have timer dedicated updating "elapsed time" property. violates separation of concerns principle. i'd happier timer in ui unsure how force binding refresh without updating property value.
even better, there way can tell binding refresh @ regular intervals?
<textblock text="{binding path=processstartedat, converter={staticresource elapsedtime}}"/>
i throw timer inside valueconverter class , raise event call convert method each time interval hit.
this keeps valueconverter focused on responsibility.
Comments
Post a Comment