I want to be able to create a fade animation on a text element when the
binding to that element updates. In other words, the effect is that as
text gets added to a text box one sees a fading effect as the text updates
and then fades out. I do'nt know how to achieve this. I have seen something similar
using an EventTrigger
on a RoutedEvent
such as FrameworkElement.Loaded
but how does one detect when a binding updates?
Thanks.
You can set properties on your binding that will cause events to be fired. There are two properties available:
- NotifyOnSourceUpdated: Raise the SourceUpdated event when a value is transferred from the binding target to the binding source.
- NotifyOnTargetUpdated: Raise the TargetUpdated event when a value is transferred from the binding source to the binding target.
From the description of your setup, it sounds like you want to use NotifyOnTargetUpdated. Set that to true in your binding, then whenever the target updates, the Binding.TargetUpdated event will fire. You can then listen to that event in an EventTrigger, and fade your text.