【问题标题】:navigating to a page class in a library in WP8导航到 WP8 库中的页面类
【发布时间】:2014-05-07 15:11:48
【问题描述】:

我在 windows phone 类库中创建了一个页面类,并在 windows phone 应用程序项目 (WP8) 中引用了该 dll。

现在如何导航到在库中创建的页面类。如何指定 uri? 请提供确切的 API 和语法。

我尝试使用 this.frame.Navigate(typeof(pagename)) 以及 NavigationService.Navigate(new uri("/pagename.xaml",UriKind.relative ))..以上都不起作用..我假设uri中指定的路径有错误..

【问题讨论】:

  • 您在使用 this.Frame.Navigate(typeof(pagename)); 时遇到什么错误?因为我自己尝试过(在 windows phone 类库中),它就像一个魅力

标签: xaml windows-phone-8 uri


【解决方案1】:

以下确实对我有用。

    NavigationService.Navigate(new Uri("/AssemblyName;component/MyPage.xaml", UriKind.Relative));

或者概括 Uri ,它的格式应该是:/{assemblyName};component/{pathToResource}

只要确保你没有点“。”在您的程序集名称中,因为它可能会导致某些 uri 格式异常。

希望这行得通。

【讨论】:

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