silverlight - 导航到 Windows Phone 7 中不同程序集中的 XAML 页面

标签 silverlight windows-phone-7 navigation

我在单独的 Windows Phone 类库中有一个 XAML 页面。该库包含在我的 VS 解决方案中,并从我的应用程序项目中引用。假设该页面名为 TestPage.xaml,位于我的库的根文件夹中,名为 SharedPages

我想使用 NavigationService 在我的应用程序中导航到此页面。我发现this post建议使用此 URI 格式:

/{assemblyName};component/{pathToResource}

所以我正在尝试这样的事情:

NavigationService.Navigate(new Uri("/SharedPages;component/TestPage.xaml"));

当我运行此程序时,出现以下异常:

导航仅支持片段式相对 URI、以“/”开头或包含“;component/”的相对 URI。

我做错了什么?

谢谢。

最佳答案

看起来 URI 需要创建为相对 URI。这有效:

NavigationService.Navigate(new Uri("/SharedPages;component/TestPage.xaml", UriKind.Relative));

关于silverlight - 导航到 Windows Phone 7 中不同程序集中的 XAML 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4985938/

相关文章:

jquery - 如何阻止导航栏阻止页面

c# - Silverlight 页面检查用户是否登录

c# - 当应用程序在后台时显示消息框

android - 使用 backstack 时 fragment 未替换

c# - 使用内置应用程序编写具有 facebook 共享或推文的 WP7 应用程序

windows-phone-7 - 在 Azure 上运行应用程序并保护注册

javascript - 我怎样才能对这段代码进行按键操作?

silverlight - 如何在Silverlight中赋予文本框焦点?

silverlight - 平面投影在 Silverlight 中运行不佳

.net - 从 Silverlight 浏览器外应用程序使用 Google OAuth2