title: How to navigate to another page with the click of a button that's already inside a page?
body: <ul>
  <li>I have a <em>Window</em> that contains a <strong>frame</strong>.</li>
  <li>I have two pages, <strong>Page1</strong> and <strong>Page2</strong>, and ... inside them, I
  have a <strong>Button</strong>.</li>
  <li>When the <em>Window</em> is loaded the <strong>frame</strong> navigates to Page1.</li>
  </ul>
  
  <p>I want the frame to navigate to <strong>Page2</strong> by clicking on the <strong>Button</strong> in the <strong>Page1</strong>.</p>
  
  <hr>
  
  <p>I tried to use MVVM:</p>
  
  <p>That's the Window XAML.</p>
  
  <pre><code>&lt;Window x:Class="MVVM_Course.Navigation"&gt;
      &lt;Window.DataContext&gt;
          &lt;viewmodel:NavigationViewModel/&gt;
      &lt;/Window.DataContext&gt;
      &lt;Grid&gt;
          &lt;Frame x:Name="frame" Content="{Binding Page, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>The Window ViewModel:</p>
  
  <pre><code>public class NavigationViewModel
  {
      private static object page;
      public static object Page { get { return page; } set { page = value; } }
  
      public static void ChangePage(object objpage){Page = objpage;}
  
      public NavigationViewModel()
      {
          ChangePage(new Page1());
      }
  }
  </code></pre>
  
  <p>The Page1 XAML:</p>
  
  <pre><code>&lt;Page x:Class="MVVM_Course.Page1"&gt;
      &lt;Page.DataContext&gt;
          &lt;vm:Page1ViewModel/&gt;
      &lt;/Page.DataContext&gt;
      &lt;Grid&gt;
          &lt;Button x:Name="btnGoTo2" FontSize="50" Command="{Binding BtnPage2Command}" Content="Go to Page 2"/&gt;
      &lt;/Grid&gt;
  &lt;/Page&gt;
  </code></pre>
  
  <p>The Page1 ViewModel:</p>
  
  <pre><code>class Page1ViewModel
  {
      private ICommand btnPage2Command;
      public ICommand BtnPage2Command { get { return btnPage2Command; } set { btnPage2Command = value; } }
      public Page1ViewModel()
      {
          BtnPage2Command = new RelayCommand(GoToPage2);
      }
      private void GoToPage2(object obj)
      {
          NavigationViewModel.ChangePage(new Page2());
      }
  }
  </code></pre>
  
  <blockquote>
    <p>When I compile, the frame navigates to Page1 but clicking on the
    Button does not change the Page. Using the debugging red circle tool
    it seems to be working, the property "Page" in NavigationViewModel
    changes from Page1 to Page2 but... the result is that nothing actually
    happens in the UI.</p>
  </blockquote>