我可以使用NavigationContext.QueryString设置参数吗?(Windows Phone)
本文关键字:Windows Phone 参数 可以使 NavigationContext QueryString 设置 我可以 | 更新日期: 2023-09-27 18:29:04
我可以像这样将值传递到导航上下文吗:
NavigationContext.QueryString["param1"] = "PARAM1";
这是设置参数的好方法吗?
首先,为什么需要在NavigationContext.QueryString
中存储一些参数?还有另一个好地方。
如果您想将参数传递到另一个页面,请使用以下方法:
NavigationService.Navigate(new Uri("SomePage.xaml?param1=PARAM1"))
如果需要将一些值保存到状态字典中,可以使用PhoneApplicationService.Current.State
(全局)或PhoneApplicationPage.State
(页面特定)