使用 NavigationService 导航到代码隐藏中的新页面

发布于 2024-12-25 00:02:52 字数 615 浏览 2 评论 0原文

我想访问我的页面来设置 XAML 页面:

Dim Pg As New PageListPickerSelection
Pg.StartCalculating(199,"Z-UU", MyCalculationDataIEnumList, myImageSource)
App.NavigationService.Navigate(New Uri("/uc/ListPicker/PageListPickerSelection.xaml", UriKind.Relative))

但是 NavigationService.Navigate 不支持对象 或引用的页面。

显示自己页面的正确步骤是怎样的?

或者换个方式问:“WP7中的ListPicker”如何解决这个问题当显示他的分离页面时?

问候

I want to access my page to setup the XAML Page:

Dim Pg As New PageListPickerSelection
Pg.StartCalculating(199,"Z-UU", MyCalculationDataIEnumList, myImageSource)
App.NavigationService.Navigate(New Uri("/uc/ListPicker/PageListPickerSelection.xaml", UriKind.Relative))

But NavigationService.Navigate does not support Objects or referenced pages.

How is the correct procedure to show the own page?

Or asked in another way: How does the "ListPicker in the WP7" solve this when showing his separated page?

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

流星番茄 2025-01-01 00:02:52

如果我理解您的问题,您是在问如何在导航到页面之前配置该页面,对吗?
当您动态导航到页面时,导航服务将创建您的页面。不可能将页面作为对象提供给导航服务如果您需要将数据传递到页面中,您可以使用将参数附加到 URI 的常规方法(使用 C#,因为我不熟悉 VB):

NavigationService.Navigate(new Uri("/uc/ListPicker/PageListPickerSelection.xaml?Param1=" + (199).ToString() + "&Parm2=" + "Z-UU", UriKind.Relative));

稍后在 PageListPickerSelection 的 OnNavigateTo() 方法中,您可以再次解析参数,如下所示:

string p1 = this.NavigationContext.QueryString["Param1"];
string p2 = this.NavigationContext.QueryString["Param2"];

If I understand your question, you are asking how to configure a page before navigating to it, correct?
The navigation service will create your pages as you navigate to them on the fly. It is not possible to give the navigation service the page as an object If you need to pass data into a page you can use the normal method of appending params to a URI as such (using c# as I am not familiar with VB):

NavigationService.Navigate(new Uri("/uc/ListPicker/PageListPickerSelection.xaml?Param1=" + (199).ToString() + "&Parm2=" + "Z-UU", UriKind.Relative));

Later in the PageListPickerSelection's OnNavigatedTo() method you can parse the parameters again as such:

string p1 = this.NavigationContext.QueryString["Param1"];
string p2 = this.NavigationContext.QueryString["Param2"];
小兔几 2025-01-01 00:02:52

您可以使用一个静态类,其中有几个静态值,您可以在离开第一页时写入这些静态值,并在打开第二页时读取这些静态值。

如果您不喜欢静态类/变量,您可以使用单例。

You could use a static class in which you have a couple of static values which you write when leaving the first page and read when opening the second page.

If you don't like static classes / variables you could use a singleton.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文