title: Calling Loaded Event of Page From Window C# WPF
body: <p>I have a <code>Window</code> that contains a number of <code>Buttons</code>, all of which are supposed to display a different <code>PDF</code> inside of the <code>Window</code>. To do this I use a <code>Frame</code> on the <code>Window</code> that I display a <code>Page</code> in using;</p>
  
  <pre><code>private void OnPDFButton1Click(object sender, RoutedEventArgs e)
  {
      navigationFrame.Navigate(new Uri("View/PDFPage.xaml", UriKind.Relative));
  }
  </code></pre>
  
  <p>To display the <code>PDF</code> inside the <code>Page</code>, I take advantage of it's <code>Loaded</code> event;</p>
  
  <pre><code>private void OnPageLoad(object sender, RoutedEventArgs e)
  {
      var _buttonPathDataService = new ButtonPathDataService();
      try
      {
          var pdfURI = new Uri(_buttonPathDataService.GetButtonPath(Properties.Settings.Default.VideoMode));
          PDFWebBrowser.Navigate(pdfURI);
      }
      catch (Exception ex)
      {
          MessageBox.Show("No PDF linked!");
      }
  }
  </code></pre>
  
  <p>The issue I am having with this is say the user has clicked one on <code>Button</code> to display a <code>PDF</code>, this works fine. However, if the user clicks on another <code>Button</code>,  because it is using the same <code>Page</code> (PDFPage.xaml) the <code>OnPageLoad</code> is never fired due to (quite obviously) the <code>Page</code> having already been loaded for the previous <code>PDF</code>.</p>
  
  <p>My question is how can I call an event on the <code>PDFPage</code>, from my main <code>Window</code> that tells the <code>PDFWebBrowser</code> to navigate to a new <code>Uri</code>? Essentially how would I move the contents of the page's <code>Loaded</code> event into a method that can be called on a <code>Button</code> click in the <code>Window</code>.</p>