How to animate Margin property in WPF

前端 未结 5 742
攒了一身酷
攒了一身酷 2020-12-13 09:23

I want to move animate an rectangle object to move it in x-axis. I am new to WPF animation, started out with the following:



        
5条回答
  •  情歌与酒
    2020-12-13 09:37

    Actually, ya you can do what you want to do, exactly as you want to do using RenderTransform mixed with some DoubleAnimation and even add some extra flair to it, for example;

    
          
                
          
          
                
                      
                             
                                  
                                       
                                  
                                  
                                       
                                  
                             
                      
                
          
    

    Will move that object 50px on the X axis and even fade it in while it does so. Give it a shot and play with the values of the X property and the KeyTime to get what you want. Hope this helps, cheers.

提交回复
热议问题