title: How to handle an XML parse exception on View resource?
body: <p>I got an error on my LoginView, of type XML parse exception. So I checked the inner error details and it tells me a visibility converter resource can't be found.</p>
  
  <p>The complete error:</p>
  
  <pre><code>"{"Cannot find resource named 'BoolToNonVisibilityConverter'. Resource names are case sensitive."}"
  </code></pre>
  
  <p>I understand from this that the xml parser can't find the converter class. But I checked the namespaces and reference, and all seems to be fine besides.</p>
  
  <p>I'm thinking maybe the resource can't be found as the Visibility binding is set on the UserControl, before the resource declaration. <a href="http://www.paulkiddie.com/2011/10/the-importance-of-the-position-of-window-resources-element-in-wpf-xaml-markup/" rel="nofollow">This answer</a> did provide some detail on that.</p>
  
  <p>Does anyone know why the resource isn't being found at run time?</p>
  
  <p>This is the LoginView definition, containing the BoolToNonVisibilityConverter resource reference:</p>
  
  <pre><code>&lt;UserControl x:Class="MongoDBApp.Views.LoginView"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:btv="clr-namespace:MongoDBApp.Converters"
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               xmlns:pass_helper="clr-namespace:MongoDBApp.Helpers"
               Visibility="{Binding LoggedIn,
                                    Converter={StaticResource BoolToNonVisibilityConverter}}"
               d:DesignHeight="300"
               d:DesignWidth="300"
               mc:Ignorable="d"&gt;
  
      &lt;UserControl.Resources&gt;
          &lt;btv:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" /&gt;
          &lt;btv:BoolToNonVisibilityConverter x:Key="BoolToNonVisibilityConverter" /&gt;
      &lt;/UserControl.Resources&gt;
  
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="*" /&gt;
              &lt;RowDefinition Height="2*" /&gt;
              &lt;RowDefinition Height="1*" /&gt;
              &lt;RowDefinition Height="1*" /&gt;
              &lt;RowDefinition Height="1*" /&gt;
              &lt;RowDefinition Height="1*" /&gt;
              &lt;RowDefinition Height="1*" /&gt;
              &lt;RowDefinition Height="1*" /&gt;
              &lt;RowDefinition Height="1*" /&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="1*" /&gt;
              &lt;ColumnDefinition Width="4*" /&gt;
              &lt;ColumnDefinition Width="2*" /&gt;
              &lt;ColumnDefinition Width="1*" /&gt;
              &lt;ColumnDefinition Width="2*" /&gt;
              &lt;ColumnDefinition Width="*" /&gt;
          &lt;/Grid.ColumnDefinitions&gt;
  
  
          &lt;GroupBox Name="groupBox3"
                    Grid.RowSpan="7"
                    Grid.ColumnSpan="5"
                    Width="250"
                    Height="250"
                    Header="Login"&gt;
              &lt;Grid&gt;
                  &lt;Button Name="LoginWithWidget"
                          Width="102"
                          Height="22"
                          Margin="68,126,71,70"
                          Command="{Binding LoginCommand}"
                          Content="Login" /&gt;
  
                  &lt;TextBox Name="UserTextBox"
                           Width="94"
                           Height="23"
                           Margin="119,24,0,171"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Center"
                           Text="{Binding User}" /&gt;
                  &lt;Label Name="label1"
                         Height="28"
                         Margin="34,24,0,166"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Center"
                         Content="Username" /&gt;
                  &lt;Label Name="label2"
                         Height="28"
                         Margin="34,64,0,126"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Center"
                         Content="Password" /&gt;
  
              &lt;/Grid&gt;
          &lt;/GroupBox&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>