我有一个全景页面,其中我有3个按钮。我已经添加了一个数据透视页到同一个项目,其中有3个数据透视项目。当我单击全景页中的Button 1时,它应该转到pivot页中的第一个透视项,当我单击全景页中的按钮2时,它应该转到pivot页中的第二个枢轴项。如何实现此导航?请让我知道。
发布于 2012-02-15 05:58:47
您可以将查询字符串传递给pivot页面,然后,一旦加载了pivot,就将索引设置为相关页面。作为一个基本示例,您可以像这样处理button 2:
NavigationService.Navigate(new Uri("/myPivotPage.xaml?id=2", UriKind.Relative));然后,在透视页的Loaded事件中,可以像这样设置到索引的跳转:
string pivotIndex = "";
if(NavigationContext.QueryString.TryGetValue("id", out pivotIndex))
{
//-1 because the Pivot is 0-indexed, so pivot item 2 has an index of 1
myPivot.SelectedIndex = Convert.ToInt32(pivotIndex) - 1;
}https://stackoverflow.com/questions/9284334
复制相似问题