I have a simple class that represents a timer (simplified for clarity):
public class Timer {
DateTime startTime;
// How do I notify the UI that this property is changing?
public TimeSpan Value {
get {
return DateTime.Now - startTime;
}
}
public void Start() {
startTime = DateTime.Now;
}
}
And a page containing a TextBlock
and an instance of a Timer
.
I'd like to databind the TextBlock
's Text
property to show the Timer.Value
. However, this field is obviously changing constantly, so firing PropertyChanged
events doesn't seem to make any sense.
Is there some way to indicate that a property is always changing, so that the UI updates as fast as is reasonably possible?