【问题标题】:Windows Phone page navigation does not workWindows Phone 页面导航不起作用
【发布时间】:2015-06-13 12:49:22
【问题描述】:

我是为 Windows Phone 创建应用程序的新手。我在重定向到另一个页面时遇到了问题。我用HyperlinkButton创建了空白页,在.cs文件中我写了这个:

private void but_elf_Click(object sender, RoutedEventArgs e)
{
    this.Frame.Navigate(typeof(Elfy));
}

在 xaml 中:

<HyperlinkButton x:Name="but_elf" Content="Elfy"  
    HorizontalAlignment="Center" Margin="100,125,100,255" Grid.Row="1" 
    VerticalAlignment="Center" Width="200" Height="70" />

当我启动应用程序并单击按钮时 - 没有任何反应。没有错误,没有消息。我试图将NavigateUri 放在按钮的属性中,但在按下按钮(在启动的应用程序中)后,消息显示:“您需要为此任务安装一个应用程序。您想在商店中搜索一个吗?”按“是”后,应用会显示:“抱歉,未找到任何应​​用”。

如何解决这个问题?我正在.NET Framework 4.5 中为 Windows Phone 8.1 创建应用程序。感谢您的帮助。

【问题讨论】:

    标签: c# .net navigation windows-phone-8.1


    【解决方案1】:

    您缺少对“单击”事件处理程序的引用。请将您的 XAML 更改为:

    <HyperlinkButton x:Name="but_elf" Content="Elfy"  
    HorizontalAlignment="Center" Margin="100,125,100,255" Grid.Row="1" 
    VerticalAlignment="Center" Width="200" Height="70" Click="but_elf_Click" />
    

    请看:

    C# Documentation for Click on MSDN

    C# Documentation for HyperlinkButton on MSDN

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-11
      • 1970-01-01
      相关资源
      最近更新 更多