Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Windows Phone 7 passing multiple items between pages

Windows Phone 7 passing multiple items between pages

Scheduled Pinned Locked Moved C#
questionwpfhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paul Harsent
    wrote on last edited by
    #1

    Hi, I am building a simple windows phone 7 app. I need to pass more that one data item between pages. I know you need to make a small change to sending one data item across but im not sure what this change is. Currently I send one item across like this:

    phoneApplicationPage.NavigationService.Navigate(new Uri("/Pages/View_Stickies.xaml?string=" + info, UriKind.RelativeOrAbsolute));

    Where in this case info is the string sent. I unpack it on page 2 like this:

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (this.NavigationContext.QueryString.ContainsKey("string"))
            {
               string GPS = this.NavigationContext.QueryString\["string"\];
               MessageBox.Show(GPS);
            }
    
            base.OnNavigatedTo(e);
        }
    

    Im sure there is a very simple answer to the question and any help would be great. Thanks

    P 1 Reply Last reply
    0
    • P Paul Harsent

      Hi, I am building a simple windows phone 7 app. I need to pass more that one data item between pages. I know you need to make a small change to sending one data item across but im not sure what this change is. Currently I send one item across like this:

      phoneApplicationPage.NavigationService.Navigate(new Uri("/Pages/View_Stickies.xaml?string=" + info, UriKind.RelativeOrAbsolute));

      Where in this case info is the string sent. I unpack it on page 2 like this:

          protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
          {
              if (this.NavigationContext.QueryString.ContainsKey("string"))
              {
                 string GPS = this.NavigationContext.QueryString\["string"\];
                 MessageBox.Show(GPS);
              }
      
              base.OnNavigatedTo(e);
          }
      

      Im sure there is a very simple answer to the question and any help would be great. Thanks

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      As you are passing a query string across, all you need to do is add the second key value pair after a &, so your example could become:

      string.Format("/Pages/View_Stickies.xaml?string={0}&id={1}", info, id)

      I'm not a stalker, I just know things. Oh by the way, you're out of milk.

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Onyx

      P 1 Reply Last reply
      0
      • P Pete OHanlon

        As you are passing a query string across, all you need to do is add the second key value pair after a &, so your example could become:

        string.Format("/Pages/View_Stickies.xaml?string={0}&id={1}", info, id)

        I'm not a stalker, I just know things. Oh by the way, you're out of milk.

        Forgive your enemies - it messes with their heads

        My blog | My articles | MoXAML PowerToys | Onyx

        P Offline
        P Offline
        Paul Harsent
        wrote on last edited by
        #3

        Thank you very much.

        P 1 Reply Last reply
        0
        • P Paul Harsent

          Thank you very much.

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          You're welcome.

          I'm not a stalker, I just know things. Oh by the way, you're out of milk.

          Forgive your enemies - it messes with their heads

          My blog | My articles | MoXAML PowerToys | Onyx

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups