WPF中textBlock 变色功能

原文: WPF中textBlock 变色功能

       
  <Window.Resources>
 <Storyboard x:Key="OnLoaded" RepeatBehavior="Forever" AutoReverse="True"  >
            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="btn_Register">
                <EasingColorKeyFrame KeyTime="0:0:1" Value="LightBlue"/>
                <EasingColorKeyFrame KeyTime="0:0:2" Value="LightGreen"/>
            </ColorAnimationUsingKeyFrames>
        </Storyboard>
    </Window.Resources>
    <Window.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard  Storyboard="{StaticResource OnLoaded}"/>
        </EventTrigger>
    </Window.Triggers>
<Button
                    Name="btn_Register"
                    Margin="62,26,-60,2"
                    Content="新用户注册"
                    Command="{Binding Path=RegisterCmd}"
Foreground="#FF91B9EA" Grid.Column="2" Width="Auto" FontWeight="Bold" FontSize="14"/>

猜你喜欢

转载自www.cnblogs.com/lonelyxmas/p/10516065.html