2014-10-17 47 views
0

我有一個從屏幕的右下角滑出的「吐司」 WPF窗口 - 我如何添加一個 輕鬆滑動該反彈了一下吐司幻燈片將緩解

var anim = new DoubleAnimation 
{ 
    Duration = TimeSpan.FromMilliseconds(280), 
    From = Left, 
    To = Left - (Width * 2), 
}; 
this.BeginAnimation(Window.LeftProperty, anim); 

回答

0
var anim = new DoubleAnimation 
{ 
    Duration = TimeSpan.FromMilliseconds(280), 
    From = Left, 
    To = Left - (Width * 2), 
    EasingFunction = new BounceEase() 
}; 

DoubleAnimation Class (System.Windows.Media.Animation) - MSDN
Easing Functions - MSDN

+0

我可以設置方便的距離和時間? – cablehead 2014-10-17 18:04:31

+0

@ user2471267請在答案中閱讀我留下的鏈接文檔。 (對於遲到的答覆,我只是看到了這一點。) – 2014-11-21 02:10:25