title: Loaded event doesn't fire in UserControl
body: <p>I have a UserControl and the <code>Loaded</code> event never fires. Why would this be? How can I get it to fire?</p>
  
  <p>The layout is defined as:</p>
  
  <pre><code>&lt;UserControl
      x:Class="MyProject.WP81.GenericPopup"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="using:MyProject.WP81"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      mc:Ignorable="d"
      d:DesignHeight="300"
      d:DesignWidth="400" Margin="0,1,0,-1"
      Loaded="GenericPopup_Loaded"&gt;
  
      &lt;Popup Name="hostPopup"&gt;
          &lt;Grid Name="contentGrid" VerticalAlignment="Center"&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition x:Name="statusBarRow" Height="0" /&gt;
              &lt;/Grid.RowDefinitions&gt;
  
              &lt;ItemsControl Name="itemsControl" VerticalAlignment="Center" HorizontalAlignment="Center" /&gt;
  
              &lt;Border Grid.Row="2" Background="#7F000000" /&gt;
          &lt;/Grid&gt;
      &lt;/Popup&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>With the logic defined as:</p>
  
  <pre><code>namespace MyProject.WP81
  {
      public sealed partial class GenericPopup : UserControl
      {
          public static bool IsOpen { get; private set; }
          public static GenericPopup Current { get; private set; }
  
          private UserControl _content;
          public GenericPopup(UserControl content)
          {
              Trace.trace("GenericPopup::Ctor()");
              _content = content;
  
              this.InitializeComponent();
  
              Initialise();
  
              SetContent(content);
          }
  
          private void Initialise()
          {
              Trace.trace("GenericPopup::Initialise()");
  
              RowDefinition rd = new RowDefinition();
              rd.MinHeight = Window.Current.Bounds.Height;
              rd.Height = new GridLength(Window.Current.Bounds.Height);
              contentGrid.RowDefinitions.Add(rd);
              contentGrid.Height = Window.Current.Bounds.Height;
              contentGrid.Width = Window.Current.Bounds.Width;
              contentGrid.Background = new SolidColorBrush(Colors.Black);
              contentGrid.Background.Opacity = 0.7;
              statusBarRow.MinHeight = Window.Current.Bounds.Height;
              statusBarRow.Height = new GridLength(Window.Current.Bounds.Height);
  
              Unloaded += (s, e) =&gt;
              {
                  Trace.trace("GenericPopup::Unloaded()");
                  HardwareButtons.BackPressed -= HardwareButtons_BackPressed;
              };
  
              Trace.trace("GenericPopup::Initialised()");
          }
  
          private void GenericPopup_Loaded(object sender, RoutedEventArgs e)
          {
              Trace.trace("GenericPopup::GenericPopup_Loaded()");
              HardwareButtons.BackPressed += HardwareButtons_BackPressed;
              _content.Width = Window.Current.Bounds.Width;
          }
  
          public void SetContent(UserControl content)
          {
              Trace.trace("GenericPopup::SetContent()");
              _content = content;
  
              _content.Width = Window.Current.Bounds.Width;
  
              itemsControl.Items.Add(_content);
          }
  
  
          public async void Show()
          {
              Trace.trace("GenericPopup::Show()");
              this.Height = Window.Current.Bounds.Height;
              this.Width = Window.Current.Bounds.Width;
  
              hostPopup.IsOpen = true;
              IsOpen = hostPopup.IsOpen;
              Current = this;
          }
  
          public static void HideCurrent()
          {
              if (Current != null)
              {
                  Current.Hide();
              }
          }
  
          internal void Hide()
          {
              //WinterfellToast.Show("msg popup:", "hide");
  
              hostPopup.IsOpen = false;
              IsOpen = hostPopup.IsOpen;
              Current = null;
          }
  
          void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
          {
              Trace.trace("GenericPopup::HardwareButtons_BackPressed()");
              e.Handled = true;
  
              if (hostPopup.IsOpen)
              {
                  hostPopup.IsOpen = false;                
              }
          }
      }
  }
  </code></pre>
  
  <p>I create the UserControl as follows:</p>
  
  <pre><code>        var popopContent = new PopupContentUserControl(); 
  
          // any UserControl can be passed in as the content of the popup.
          // better if it's small though.
          _genericPopup = new GenericPopup(popopContent);
          _genericPopup.Show();    
  </code></pre>
  
  <p>I can see the following in the trace:</p>
  
  <pre><code>&gt; 13:00:53.777  GenericPopup::Show() 
  &gt; 13:00:53.763  GenericPopup::SetContent() 
  &gt; 13:00:53.763  GenericPopup::Initialised() 
  &gt; 13:00:53.747  GenericPopup::Initialise() 
  &gt; 13:00:53.730  GenericPopup::Ctor()
  </code></pre>
  
  <p>so we can see the loaded event doesn't fire.</p>