title: How to Reference the page (view) the viewmodel is for?
body: <p>I already had someone help with this before, but now that I am rewriting everything into MVVM, I have lost the ability to do this... Again!</p>
  
  <p>Pre-MVVM rewrite, I had this line of code in the code behind my page:</p>
  
  <pre><code>var window = MahApps.Metro.Controls.TreeHelper.TryFindParent&lt;MetroWindow&gt;(this);
  </code></pre>
  
  <p>right at the end, the "this" meant the page. Now, this code is sitting in my viewmodel with a squiggly red line, and I don't know what to replace it with. I don't think I can put:</p>
  
  <pre><code>SideBar sb = new SideBar();
  var window = MahApps.Metro.Controls.TreeHelper.TryFindParent&lt;MetroWindow&gt;(sb);
  </code></pre>
  
  <p>because this would create a new instance of sidebar... wouldn't it? This page is loaded as the default source of a frame within the mainpage btw, not initiated via code.</p>