【问题标题】:Finish transition effect完成过渡效果
【发布时间】:2023-11-30 08:25:02
【问题描述】:
我有一个显示和隐藏过渡效果的菜单:
您看到的元素正在将您导航到其他页面。
所以当我导航到其他页面时,我会这样做:
MenuButton.Tag = "MenuDisabled";
VisualStateManager.GoToState(this, "HideMenu", true);
NavigationService.Navigate(new Uri("/AboutPageAuthorized.xaml", UriKind.Relative));
但碰巧导航的工作速度比效果快,所以你会看到它滑动到中间然后快速消失——这很烦人。
有没有办法处理这种破坏效果的事情?
【问题讨论】:
标签:
silverlight
windows-phone-7
xaml
windows-phone-8
expression-blend
【解决方案1】:
调用导航前加延迟,可以加延迟using System.Timers
只需在 OnTimedEvent 下添加导航事件,根据需要调整定时器即可。
//Place the effect here
// Create a timer with a ten second interval.
aTimer = new System.Timers.Timer(10000);
// Hook up the Elapsed event for the timer.
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
// Set the Interval to 2 seconds (2000 milliseconds).
aTimer.Interval = 2000;
aTimer.Enabled = true;
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
NavigationService.Navigate(new Uri("/AboutPageAuthorized.xaml", UriKind.Relative));
}