title: Closing a page in WPF
body: <p>I am new to C#, I just created a new page and want to close it in the XAML side I have:</p>
  <pre><code>&lt;Grid&gt;
      &lt;Button Content=&quot;Back&quot; Click=&quot;Button_Click_Exit&quot;
          HorizontalAlignment=&quot;Left&quot; Margin=&quot;220,263,0,0&quot;
          VerticalAlignment=&quot;Top&quot; Width=&quot;75&quot;/&gt;
  &lt;/Grid&gt;
  </code></pre>
  <p><strong>C#:</strong></p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Data;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Imaging;
  using System.Windows.Navigation;
  using System.Windows.Shapes;
  namespace UI
  {
      /// &lt;summary&gt;
      /// Interaction logic for calibrationPage.xaml
      /// &lt;/summary&gt;
      public partial class calibrationPage : Page
      {
          public calibrationPage()
          {
              InitializeComponent();
          }
  
          private void Button_Click_Exit(object sender,
              RoutedEventArgs e)
          {
              Close();
          }
      }
  }
  </code></pre>
  <p>I think this supposed to be really simple, somehow I get this error, when I try to build it:</p>
  <pre><code>error CS1061: 'UI.calibrationPage' does not contain a definition for 'Close'
  and no extension method 'Close' accepting a first argument
  of type 'UI.calibrationPage' could be found 
  </code></pre>
  <p><strong>Edit 1:</strong> I understand that <code>close()</code> does not exit, then rephrasing my question, how can I simply close the page using a button click?</p>
  <p><strong>Edit 2:</strong> For the benefit of others: I ended up using <code>PageNavigator.NavigateTo</code> function to navigate back and forth between pages, I do not think that there is a concept of closing one page in WPF. Thanks for everyone's participation.</p>