title: How do I close a window from its user control view model?
body: <p>I have a window which hosts various UserControl's as pages. Is it possible to close the window which I have no reference to from within the usercontrol's datacontext?
  Simplified details:</p>
  
  <p>SetupWindow</p>
  
  <pre><code>    public SetupWindow()
      {
          InitializeComponent();
          Switcher.SetupWindow = this;
          Switcher.Switch(new SetupStart());  
      }
  
      public void Navigate(UserControl nextPage)
      {
          this.Content = nextPage;
      }
  </code></pre>
  
  <p>SetupStart UserControl</p>
  
  <pre><code>&lt;UserControl x:Class="..."&gt;
   &lt;UserControl.DataContext&gt;
      &lt;local:SetupStartViewModel/&gt;
   &lt;/UserControl.DataContext&gt;
   &lt;Grid&gt;
      &lt;Button Content="Continue" Command="{Binding ContinueCommand}"/&gt;
   &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>SetupStartViewModel</p>
  
  <pre><code>    public SetupStartViewModel()
      {
      }
  
      private bool canContinueCommandExecute() { return true; }
  
      private void continueCommandExectue()
      {
          Switcher.Switch(new SetupFinish());
      }
  
      public ICommand ContinueCommand
      {
          get { return new RelayCommand(continueCommandExectue, canContinueCommandExecute); }
      }
  </code></pre>