4
我知道如何在透視頁面內從一個透視圖項目導航到另一個透視項目,但是如果導航是從另一個頁面完全啓動的呢?有沒有一種方法來指定哪個數據透視表項在透視頁面中導航?
UPDATE:
這裏是我使用的解決方案的基礎上,從馬特萊西答案:
從按鈕單擊事件上的MainPage:
private void button_Click(object sender, RoutedEventArgs e)
{
string parameter = "myPivotItem1";
NavigationService.Navigate(new Uri(string.Format("/MyPivotPage.xaml?parameter={0}", parameter), UriKind.Relative));
}
推翻的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;
}
}
我在哪裏以及如何做到這一點? – Marmoy
謝謝你使用術語查詢字符串,發現這個深入的解釋wp7導航和概念:http://www.windowsphonegeek.com/articles/WP7-Navigation-in-depth--Navigation-Framework – Marmoy
你提到,有傳遞您希望導航到的數據透視表的指標的不同方式是指使用隔離存儲,數據庫和其他全局存儲,這將允許您設置整個應用程序可訪問的值? – Marmoy