1
當用戶在我的應用程序中移動頁面時,簡單的動畫應該在移動之前淡出項目,但它不能正常工作並立即轉移。後退鍵不等待動畫
代碼:
public PageClass()
{
BackKeyPress += OnBackKeyPressed;
}
void OnBackKeyPressed(object sender, CancelEventArgs e)
{
foreach (var control in ContentPanel.Children)
MainPage.FadeOutObject(control);
var translation = new TranslateTransform();
PageTitle.RenderTransform = translation;
var s = new Storyboard();
Storyboard.SetTarget(s, translation);
Storyboard.SetTargetProperty(s, new PropertyPath(TranslateTransform.YProperty));
s.Children.Add(
new DoubleAnimation()
{
From = -300,
To = 0,
Duration = new Duration(TimeSpan.FromSeconds(2.0)),
EasingFunction = new PowerEase { EasingMode = EasingMode.EaseInOut }
});
s.Begin();
s.Completed += (object sd, EventArgs ea) =>
{
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
};
}
現在,這是不行的,它可以追溯到直的MainPage走,沒有任何人有線索?