如何在Windows Phone的应用程序8.1两页之间传递数据? [英] How to pass data between two pages in Windows Phone 8.1 application ?

查看:106
本文介绍了如何在Windows Phone的应用程序8.1两页之间传递数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows手机应用程序8.1在那里我有两个页面显示的数据。第一页有一个列表视图从SQLite数据库显示所有的数据,当用户点击ListView中一个项目,第二个页面,其中包含有关从数据库中特定记录的详细信息列表视图中打开。我的问题是如何使用C#中的Windows Phone 8.1实现这一目标?

I have a Windows phone 8.1 application where I have two pages displaying data. The first page has a listview displaying all of the data from an sqlite database, and when the user taps on one item in the listview, the second page opens with a listview that contains more details about that specific record from the database. My question is how to achieve this in Windows Phone 8.1 using c# ?

推荐答案

在第一页,你应该这样写:

On first page you should write something like this:

Frame.Navigate(typeof(SecondPage), someData);

有关第二页,你应该覆盖的OnNavigatedTo(NavigationEventArgs E)。
例如:

For second page you should override OnNavigatedTo( NavigationEventArgs e ). For example:

protected override void OnNavigatedTo( NavigationEventArgs e )
{
    MyData data = e.Parameter as MyData.
}

这篇关于如何在Windows Phone的应用程序8.1两页之间传递数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆