title: Window Loaded event handler: "Ensure Event Failed"
body: <p>I'm trying to do the simple task of adding an event handler for the window loading. I'm using visual studio 2017. When I type <code>Loaded=""</code> and use IntelliSense to add a new event handler, I get the error message "Ensure Event Failed" and no other information. What is wrong?</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;Window x:Class="MLD_UI_1.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:MLD_UI_1"
      mc:Ignorable="d"
      Title="MainWindow" Height="350" MinHeight="700" Width="525" MinWidth="1050"
      Loaded=""&gt;
      &lt;Grid Background="{StaticResource MainBackgroundBrush}"&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="10"/&gt;
              &lt;RowDefinition Height="40"/&gt;
              &lt;RowDefinition Height="*" MinHeight="80"/&gt;
              &lt;RowDefinition Height="200"/&gt;
              &lt;RowDefinition Height="10"/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="10"/&gt;
              &lt;ColumnDefinition Width="*" MinWidth="100"/&gt;
              &lt;ColumnDefinition Width="*" MinWidth="100"/&gt;
              &lt;ColumnDefinition Width="10"/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Border BorderThickness="2 2 1 2" BorderBrush="Black" Grid.Column="1" Grid.Row="1" Background="{StaticResource UvGradientBrush}" CornerRadius="5 0 0 5"/&gt;
          &lt;Border BorderThickness="1 2 2 2" BorderBrush="Black" Grid.Column="2" Grid.Row="1" Background="{StaticResource IrGradientBrush}" CornerRadius="0 5 5 0"/&gt;
          &lt;Border BorderThickness="2 2 1 2" BorderBrush="Black" Grid.Column="1" Grid.Row="3" Background="{StaticResource GradientBrush}" CornerRadius="5 0 0 5"/&gt;
          &lt;Border BorderThickness="1 2 2 2" BorderBrush="Black" Grid.Column="2" Grid.Row="3" Background="{StaticResource GradientBrush}" CornerRadius="0 5 5 0"/&gt;
          &lt;StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal" Margin="10 0 10 0"&gt;
              &lt;TextBlock Text="UV" FontFamily="Tahoma" Foreground="White" VerticalAlignment="Center" FontSize="20"/&gt;
          &lt;/StackPanel&gt;
          &lt;StackPanel Grid.Column="2" Grid.Row="1" Orientation="Horizontal" Margin="10 0 10 0"&gt;
              &lt;TextBlock Text="IR" FontFamily="Tahoma" Foreground="White" VerticalAlignment="Center" FontSize="20"/&gt;
          &lt;/StackPanel&gt;
          &lt;Image x:Name="imagePane1" Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="2" VerticalAlignment="Stretch" Margin="2 2 2 2"/&gt;
          &lt;Image x:Name="imagePane2" Grid.Column="2" HorizontalAlignment="Stretch" Grid.Row="2" VerticalAlignment="Stretch" Margin="2 2 2 2"/&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>