title: Get the window from a page
body: <p>How to get a window from a page , so I've got a page frame in my window :</p>
  
  <pre><code>&lt;Frame NavigationUIVisibility="Hidden" Name="frmContent" Source="Page/Page1.xaml" OverridesDefaultStyle="False" Margin="0,0,0,0"  /&gt;
  </code></pre>
  
  <p>And trying to access my window from this page this way :</p>
  
  <pre><code>private void Page_Loaded(object sender, RoutedEventArgs e)
  {
      if ((Window1)this.Parent == null)
          System.Windows.Forms.MessageBox.Show("111");
      else
      wb1.ObjectForScripting = new MyScriptObject((Window1)this.Parent);
  </code></pre>
  
  <p>But the Parent returns null , so I see "111" message,</p>
  
  <p>Where is my mistake and how to get window object correct ?</p>