Windows phone 7 有没有办法指定在透视页面中导航到哪个透视项?

Windows phone 7 有没有办法指定在透视页面中导航到哪个透视项?,windows-phone-7,navigation,pivot,Windows Phone 7,Navigation,Pivot,我知道如何在pivot页面中从一个pivot项目导航到另一个pivot项目,但是如果导航完全是从另一个页面启动的呢 更新: 以下是我使用的解决方案,基于Matt Lacey的回答: 从主页上的按钮单击事件: private void button_Click(object sender, RoutedEventArgs e) { string parameter = "myPivotItem1"; NavigationService

我知道如何在pivot页面中从一个pivot项目导航到另一个pivot项目,但是如果导航完全是从另一个页面启动的呢

更新:

以下是我使用的解决方案,基于Matt Lacey的回答:

从主页上的按钮单击事件:

private void button_Click(object sender, RoutedEventArgs e)
        {
            string parameter = "myPivotItem1";
            NavigationService.Navigate(new Uri(string.Format("/MyPivotPage.xaml?parameter={0}", parameter), UriKind.Relative)); 
        }
对pivot页面的OnNavigatedTo进行重写,并提取查询字符串:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            string newparameter = this.NavigationContext.QueryString["parameter"];
            if (newparameter.Equals("myPivotItem1"))
            {
                myPivotControl.SelectedItem = myPivotItem1;
            }
            else if (newparameter.Equals("myPivotItem2"))
            {
                myPivotControl.SelectedItem = myPivotItem2;
            }
        }

您可以将
SelectedIndex
设置为所需项目的索引

不过,要小心物品的延迟装载

更新:
在第一页上,传递要在您导航到的页面的查询字符串**中显示的数据透视项的指示符。
在包含透视的页面上的OnNavigatedTo事件中,为透视的已加载事件创建一个处理程序,并使用该处理程序设置SelectedIndex


**其他方法也可以使用。

谢谢,谷歌搜索了querystring这个术语,并在wp7导航和概念的深入解释中找到了这一点:您提到有不同的方法传递您希望导航到的轴心项目的指标,您是指使用isolatedstorage、数据库、,和其他全局存储,这将允许您设置一个可在整个应用程序中访问的值?@videre在页面之间传递数据方面,我将使用querystring或全局viewmodel。隔离的存储或数据库会被过度使用。QueryString或ViewModel的使用将取决于适用于应用程序的内容。