Animate WPF Text when binding updates, how?

后端 未结 1 1927
刺人心
刺人心 2021-01-03 04:38

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

相关标签:
1条回答
  • 2021-01-03 04:47

    You can set properties on your binding that will cause events to be fired. There are two properties available:

    1. NotifyOnSourceUpdated: Raise the SourceUpdated event when a value is transferred from the binding target to the binding source.
    2. 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.

    0 讨论(0)
提交回复
热议问题