我在WPF中创建一个表单,当用户输入错误的值时,标签文本应该从红色闪烁到黑色到红色等。您将如何在标签中创建此类效果。
答案 0 :(得分:1)
For i as Integer = 0 to 3
YourLabel.Visibility = Visibility.Hidden
'use Thread.Sleep() or Timer etc. to pause it for some time
YourLabel.Visibility = Visibility.Visible
'use Thread.Sleep() or Timer etc. to pause it for some time
Next
或者,您可以使用故事板动画来达到同样的效果:
<Storyboard x:Key="BlinkAnimation">
<DoubleAnimation Storyboard.TargetName="YourLabel"
Storyboard.TargetProperty="Opacity"
From="0" To="1" RepeatBehavior="5x"
AutoReverse="True" Duration="0:0:0.5"/>
</Storyboard>