title: WPF good practice about open window and back button
body: <p>I'm beginner programmer in WPF MVVM C#. When user install my app he will follow a tutorial. So, for each "screen" of tutorial I created a Window.
  On each screen, I have a Back Button. </p>
  
  <p>So, I'm really confused on the good practice about open new window and back to the previous Window. What is the best way to do this? Currently, I'm doing:</p>
  
  <p><strong>First Window (Next Step Button) - ViewModel1</strong></p>
  
  <pre><code>&lt;Button Command="{Binding NextWindowCommand}" &gt;
  
  
  public void NextWindow(object parameter)
  {
      var newWindow = new Window2();
      newWindow.Show();
      newWindow.DataContext = new ViewModel2();
      CloseWindow();
  }
  </code></pre>
  
  <p><strong>Second Window (Back Button) ViewModel2</strong></p>
  
  <pre><code>&lt;Button Command="{Binding BackWindowCommand}" &gt;
  
      public void Back(object parameter)
      {
          var backWindow = new Window1();
          backWindow.Show();
          backWindow.DataContext = new ViewModel1();
          CloseWindow();
      }
  </code></pre>
  
  <p><strong>Close Window Method (My ViewModelBase):</strong></p>
  
  <pre><code>    public bool? CloseWindowFlag
      {
          get { return _CloseWindowFlag; }
          set
          {
              _CloseWindowFlag = value;
              RaisePropertyChanged("CloseWindowFlag");
          }
      }
  
  
  public virtual void CloseWindow(bool? result = true)
  {
      Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =&gt;
      {
          CloseWindowFlag = CloseWindowFlag == null 
              ? true 
              : !CloseWindowFlag;
      }));
  }
  </code></pre>