我创建了一个自定义的图钉(Windows商店),每当控件双击/单击时,我都需要导航
所以我发现OnDoubleTapped(DoubleTappedRoutedEventArgs e)
会这样做,但是当我尝试时......它不起作用。以下代码来自控件代码隐藏
protected async override void OnDoubleTapped(DoubleTappedRoutedEventArgs e)
{
base.OnDoubleTapped(e);
Frame.Navigate(typeof(Target)); //Frame has no Navigate()
}
这可以使用调度程序解决:
Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new DispatchedHandler(() =>
{
Frame thisFrame = Window.Current.Content as Frame;
Window.Current.Activate();
thisFrame.Navigate(typeof(Target));
}));