title: How to pass an object from a Frame to another Frame in a Windows 8 Style App
body: <p>I have problem that i just cant figure out right now.
  I am trying to develop a Windows-8 style app and im stuck implementing this functionality.</p>
  
  <p>I have a <strong>MainWindow</strong> which contains a ListBox and a Button (lets say <strong>addButton</strong>).</p>
  
  <p>When i click the button i navigate to a new page, lets say <strong>AddCustomerPage</strong> with this.Frame.Navigate(typeof (AddCustomerPage));</p>
  
  <p><strong>AddCustomerPage</strong> has 1 textBox and 1 button (lets say <strong>doneButton</strong>. When i click the button i want the string in the textBox to be added to the ListBox on the previous page.</p>
  
  <p>This is my current functionality:
  1. MainWindow is created.</p>
  
  <ol>
  <li><p>Click addButton</p></li>
  <li><p>AddCustomer page is created. MainWindow is destroyed(problem).</p></li>
  <li><p>Click doneButton</p></li>
  <li><p>A MainWindow object is created with a ListBox with 1 item.</p></li>
  <li><p>Repeat the add process, i always get a MainWindow with a ListBox with 1 item.</p></li>
  </ol>
  
  <p>Thanks for the help. Here is the code:</p>
  
  <pre><code>public sealed partial class MainPage : Page
  {
      public MainPage()
      {
          this.InitializeComponent();
  
          this.brainPageController = new PageController();
  
          // add items from the List&lt;String&gt; to the listBox
          listGoals.ItemsSource = brainPageController.GetListGoals();
      }
  
      protected override void OnNavigatedTo(NavigationEventArgs e)
      {
          var parameter = e.Parameter as String;
          // a simple controller that adds a string to a List&lt;string&gt;
          brainPageController.AddGoal(parameter);
      }
  
      private void addButton_Click(object sender, RoutedEventArgs e)
      {
          this.Frame.Navigate(typeof (GoalsInfo));
      }
  
      // VARIABLES DECLARATION
      private PageController brainPageController;
  }
  
  public sealed partial class GoalsInfo : WinGoalsWIP.Common.LayoutAwarePage
  {
      public GoalsInfo()
      {
          this.InitializeComponent();
          this.brainPageController = new PageController();
      }
  
      protected override void LoadState(Object navigationParameter, Dictionary&lt;String, Object&gt; pageState)
      {
      }
      protected override void SaveState(Dictionary&lt;String, Object&gt; pageState)
      {
      }
  
      private void Button_Click_1(object sender, RoutedEventArgs e)
      {
          brainPageController.AddGoal(nameTextBox.Text);
  
          this.Frame.Navigate(typeof(MainPage), nameTextBox.Text);
      }
      // VARIABLES DECLARATION
      PageController brainPageController;
  }
  </code></pre>