title: How to navigate to other page with button in WPF
body: <p>I have a second .xaml page set up under the name <strong><code>Page2.xaml</code></strong> and I want to make it so that when my button is clicked, the user is taken to <strong><code>Page2.xaml</code></strong></p>
  
  <p>I have this for my button inside of my <strong><code>Page1.xaml</code></strong>:</p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Button x:Name="localModeBtn" 
              Style="{StaticResource MainButtonStyle}"  
              Content="local mode" 
              Click="localModeBtn_Click" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>And for the button event handler:</p>
  
  <pre><code>private void localModeBtn_Click(object sender, RoutedEventArgs e)
      {
          Uri uri = new Uri("Page2.xaml", UriKind.Relative);
          this.NavigationService.Navigate(uri);
      }
  </code></pre>
  
  <p>Upon clicking the button I receive an error that says "Cannot locate resource <strong><code>page2.xaml</code></strong>"
  The thing is that <strong><code>Page2.xaml</code></strong> is in the same folder as <strong><code>Pag1.xaml</code></strong> so I can't see where I've gone wrong?</p>