[英]Key not found exception pivot wp7
On my detail.xaml 在我的detail.xaml
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
this.PageTitle.Text = NavigationContext.QueryString["lineone"];
this.Contents.Text = NavigationContext.QueryString["linethree"];
//populate book text control here
}
but when i enter lineone in place of line three it works fine except it shows the data of line one in the contents section. 但是当我输入lineone代替第三行时它工作正常,除了它显示内容部分第一行的数据。
I am using default pivot based layout for windows phone 7 我正在为Windows Phone 7使用默认的基于枢轴的布局
If you attempt to access a key that isn't found, you get a exception. 如果您尝试访问未找到的密钥,则会出现异常。
So instead of NavigationContext.QueryString["key"]
you should use NavigationContext.QueryString.TryGetValue("key")
因此,您应该使用NavigationContext.QueryString.TryGetValue("key")
而不是NavigationContext.QueryString["key"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.