title: How do I navigate from one xaml page to another, and pass values?
body: <p>Somewhat related to this topic here:
  <a href="https://stackoverflow.com/questions/4310595/async-xml-reading-in-windows-phone-7">Async XML Reading in Windows Phone 7</a></p>
  
  <p>I'm developing a Windows Phone app, and I have a search function in my Search.xaml.cs file. It is called by clicking a button, it creates a search query and calls DownloadStringInBackground with it</p>
  
  <pre><code>    private void SearchQuery(object sender, EventArgs e)
      {
          string temp = "http://api.search.live.net/xml.aspx?Appid=myappid&amp;query=randomqueryhere&amp;sources=web";
          DownloadStringInBackground(temp);
      }
  
      public static void DownloadStringInBackground(string address)
      {
          WebClient client = new WebClient();
          Uri uri = new Uri(address);
  
          client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCallback);
          client.DownloadStringAsync(uri);
      }
  
      private static void DownloadStringCallback(Object sender, DownloadStringCompletedEventArgs e)
      {
          // Fancy manipulation logic here
  
          finalResult = words;
      }
  </code></pre>
  
  <p>finalResult has been stored as</p>
  
  <pre><code>public static string[] finalResult;
  </code></pre>
  
  <p>in the Search class. My question is, where can I put the Navigate command (NavigationService.Navigate(new Uri("/Result.xaml", UriKind.Relative));)? I tried doing it in the callback, but I get a nullobject exception due to the static keyword. How can I ensure that finalResult has been populated, and that I can navigate to Result.xaml and reference the data in finalResult on that page. Alternately, how can I pass Words or finalResult to Result.xaml?</p>
  
  <p>Thanks for looking :)</p>