试试这个:
protected override void OnBackKeyPress( System.ComponentModel.CancelEventArgs e )
{
if( NavigationService.CanGoBack() ) {
// Cancel the navigation
e.Cancel = true;
//Create the storyboard
Storyboard anim = new MyCoolAnimation();
// Hook an on complete handler
EventHandler handler = null;
handler = ( s, e ) => {
// Navigate backward
NavigationService.GoBack();
anim.Completed -= handler;
};
anim.Completed += handler;
// Start the storyboard
anim.Begin();
}
}
Run Code Online (Sandbox Code Playgroud)