nex 代码是在文本框上制作动画的简单代码。
我需要但它的风格可以在多个文本框上制作动画。
我尝试但我失败了。
代码
<TextBox Grid.Column=" 1" Margin=" 5">
<TextBox.Background >
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop x:Name="sd1" Color="White" Offset="0"/>
<GradientStop x:Name="sd2" Color="#FF5F5F5F" Offset="1"/>
</LinearGradientBrush>
</TextBox.Background>
<TextBox.Triggers >
<EventTrigger RoutedEvent="GotFocus">
<BeginStoryboard >
<Storyboard >
<DoubleAnimation Storyboard.TargetName="sd1" Storyboard.TargetProperty="Offset" From="0" To="1" Duration="0:0:2"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="LostFocus" >
<BeginStoryboard >
<Storyboard >
<DoubleAnimation Storyboard.TargetName="sd1" Storyboard.TargetProperty="Offset" From="1" To="0" Duration="0:0:2"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBox.Triggers>
</TextBox>
谢谢你 ....