【问题标题】:How to navigate to specified panorama item from another page如何从另一个页面导航到指定的全景项目
【发布时间】:2013-01-11 20:31:57
【问题描述】:

我有MainPage.xamlPanoramaPage1.xaml

如何在PanoramaPage 中从MainPage 导航到Item1Item2

例如: Button1->Item1Button2->Item2

【问题讨论】:

    标签: c# windows-phone-7 navigation panorama-control


    【解决方案1】:

    您可以使用标准导航:

    this.NavigationService.Navigate(new Uri("PanoramaPage1.xaml?buttonid=button1",UriKind.Relative));
    

    在对象变量中传递您的目标,然后在全景页面中处理:

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
      if ( this.NavigationContext.QueryString.ContainsKey( "buttonid" ) 
      {
          string buttonid = this.NavigationContext.QueryString[ "buttonid" ];
      }
    }
    

    【讨论】:

    • 错误:方法“导航”没有重载需要 2 个参数
    • 好的,我现在有了我的参数,我可以使用if(parameter.Equals("1") NAVIGATE_TO_ITEM1; else NAVIGATE_TO_ITEM2;,但是如何导航到全景项目?
    • 我的意思是我不能在 OnNavigatedTo 方法中使用 Panorama.DefaultItem、PanoramaPage1.DefaultItem 或 this.DefaultItem
    • 所以试试其他事件 On_Load 什么的。你总是检查参数是否存在所以不会有问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-20
    • 2010-10-08
    • 2020-09-03
    • 2012-09-18
    相关资源
    最近更新 更多