wpf Visibility 动画

2021-06-23 23:04

阅读:413

标签:targe   triggers   csdn   corn   post   clipboard   strong   实现   nbsp   

 

XAML实现:

[xhtml] view plaincopy
 
"100" Width="80" CornerRadius="11,11,11,11" Margin="5" BorderThickness="2" Background="Brown" IsEnabled="False" Name="Bord11">  
    "Border.Loaded" >  
            "Visibility" Duration="0:0:4">  
                            "0:0:1" >  
                                    Visible"0:0:2" >  
                                    Hidden"0:0:3" >  
                                    Collapsed  

 

  

后台实现:

[c-sharp] view plaincopy
  1. ObjectAnimationUsingKeyFrames animate = new ObjectAnimationUsingKeyFrames();  
    animate.Duration = new TimeSpan(0,0,4);  
    animate.RepeatBehavior = RepeatBehavior.Forever;  
    DiscreteObjectKeyFrame kf1 = new DiscreteObjectKeyFrame(Visibility.Visible, new TimeSpan(0, 0, 1));  
    DiscreteObjectKeyFrame kf2 = new DiscreteObjectKeyFrame(Visibility.Hidden, new TimeSpan(0, 0, 2));  
    DiscreteObjectKeyFrame kf3 = new DiscreteObjectKeyFrame(Visibility.Collapsed, new TimeSpan(0, 0,3));  
    animate.KeyFrames.Add(kf1);  
    animate.KeyFrames.Add(kf2);  
    animate.KeyFrames.Add(kf3);  
    Bord11.BeginAnimation(Border.VisibilityProperty, animate); 

wpf Visibility 动画

标签:targe   triggers   csdn   corn   post   clipboard   strong   实现   nbsp   

原文地址:https://www.cnblogs.com/robertyao/p/10182979.html


评论


亲,登录后才可以留言!