在 Windows Phone 应用中导航需要额外的应用
Navigating in Windows Phone App requires additional App
我目前正在为 Windows Phone 10 的 Lumia 1520 Visual Studio 开发 Windows Phone 应用程序。
要在 MainPage 和 SecondPage 之间导航,我使用代码:
private void HyperlinkButton_Click(object sender, RoutedEventArgs e){
Frame.Navigate(typeof(SecondPage));
}
在我的 Phone 上单击应用程序中的按钮时,我收到以下信息:
The task requires an additional App. Would you like to search the store for it? (Yes/No)
当我点击 "Yes" 时,我被重定向到商店,我在那里收到信息:
Your search for "ms-resource" had no results.
我的phone需要什么样的应用程序?是否有另一种无需安装额外应用程序即可在页面之间导航的方法?
问题是您已经为 HyperLinkButton 定义了 NavigateUri。 删除 该属性和到第二页的导航应该可以正常工作。
更详细地说,您的代码很可能如下所示:
<HyperlinkButton NavigateUri="SecondPage.xaml" Click="ButtonBase_OnClick" Content="Hello"/>
你提到的代码是这样的:
Frame.Navigate(typeof (SecondPage));
现在当您单击超链接时,会发生这种情况:
但是现在,如果您从 XAML 中删除 NavigateUri:
<HyperlinkButton Click="ButtonBase_OnClick" Content="Hello"/>
导航有效:
这种行为是somewhat vaguely described on MSDN:
HyperlinkButton is a control, so it has input events such as Tapped,
and it's a ButtonBase subclass so it also has a Click event. You don't
typically specify a value for NavigateUri and also handle input events
that are interpreted as clicking the HyperlinkButton. The action of
opening the NavigateUri in a default browser is a system action that
takes place without requiring any event handling.
我目前正在为 Windows Phone 10 的 Lumia 1520 Visual Studio 开发 Windows Phone 应用程序。 要在 MainPage 和 SecondPage 之间导航,我使用代码:
private void HyperlinkButton_Click(object sender, RoutedEventArgs e){
Frame.Navigate(typeof(SecondPage));
}
在我的 Phone 上单击应用程序中的按钮时,我收到以下信息:
The task requires an additional App. Would you like to search the store for it? (Yes/No)
当我点击 "Yes" 时,我被重定向到商店,我在那里收到信息:
Your search for "ms-resource" had no results.
我的phone需要什么样的应用程序?是否有另一种无需安装额外应用程序即可在页面之间导航的方法?
问题是您已经为 HyperLinkButton 定义了 NavigateUri。 删除 该属性和到第二页的导航应该可以正常工作。
更详细地说,您的代码很可能如下所示:
<HyperlinkButton NavigateUri="SecondPage.xaml" Click="ButtonBase_OnClick" Content="Hello"/>
你提到的代码是这样的:
Frame.Navigate(typeof (SecondPage));
现在当您单击超链接时,会发生这种情况:
但是现在,如果您从 XAML 中删除 NavigateUri:
<HyperlinkButton Click="ButtonBase_OnClick" Content="Hello"/>
导航有效:
这种行为是somewhat vaguely described on MSDN:
HyperlinkButton is a control, so it has input events such as Tapped, and it's a ButtonBase subclass so it also has a Click event. You don't typically specify a value for NavigateUri and also handle input events that are interpreted as clicking the HyperlinkButton. The action of opening the NavigateUri in a default browser is a system action that takes place without requiring any event handling.