title: WPF Close UserControl in Frame and access Parent Controls
body: <p>I have a WPF app with a Window (RootWindow) with a Toolbar and a Frame (ContentFrame). Initially the Toolbar is hidden.</p>
  
  <p>I load a Login UserControl into the Frame and when the user correctly logs in I'd like to close the UserControl and then make the Parent Window toolbar visible.</p>
  
  <p>Seems such a simple thing to do.</p>
  
  <p>However, you cannot close a UserControl from within the UserControl. So how do I break out of the UserControl so I can remove it from the RootWindow (ContentFrame.Source=Nothing) and also make the toolbar Visible.</p>
  
  <p>I can get a handle for the Parent Window with the following code but I cannot access the controls within it</p>
  
  <pre><code>Dim parentWindow As Window = Window.GetWindow(Me) 'Get a handle for parent window
  </code></pre>
  
  <p>Ideally, I'd like to be able to access Parent Window Controls from within a Child UserControl or at least be able to Trigger an event in the Parent Window from the Child UserControl.</p>