title: Why isn't my ResourceDictionary xaml file being found?
body: <p>I have a Xamarin project with the following structure:  </p>
  
  <blockquote>
    <p>MyApp<br>
    &emsp;- Converters<br>
    &emsp;- Models<br>
    &emsp;- Styles<br>
    &emsp;&emsp;-Colors.xaml<br>
    &emsp;- ViewModels<br>
    &emsp;- Views<br>
    &emsp;&emsp;-ListPage.xaml<br>
    &emsp;&emsp;&emsp;-ListPage.xaml.cs</p>
  </blockquote>
  
  <p>I am trying to use Colors.xaml as an external Resource Dictionary for my app-wide color scheme. I've added the source to the 'ListPage.xaml' resources like so:</p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;ContentPage.Resources&gt;
          &lt;ResourceDictionary Source="Styles/Colors.xaml"/&gt;
          &lt;!--&lt;ResourceDictionary&gt;
              &lt;converter:StatusToColorConverter x:Key="StatusToColorConverter" /&gt;
          &lt;/ResourceDictionary&gt;--&gt;
      &lt;/ContentPage.Resources&gt;
  </code></pre>
  
  <p>When I try to build the project I get several build errors that seem to start with the error<br>
  <code>Resource "Styles/Colors.xaml not found.</code></p>
  
  <p>I've tried removing the class tag from the Colors.xaml file as well as the code-behind (obviously there isn't one in my structure) file as per <a href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/resource-dictionaries" rel="nofollow noreferrer">this documentation</a> and that still didn't solve the problem. I've also added the same <code>&lt;ResourceDictionary Source="Styles/Colors.xaml"/&gt;</code> to my App file to no avail. What am I missing in order to direct the ListPage.xaml to the Colors.xaml file?</p>
  
  <p>All relevant code below:<br>
  <strong>Colors.xaml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms" 
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"&gt;
      &lt;!--Color Scheme--&gt;
      &lt;Color x:Key="ColorBackground"&gt;#333333&lt;/Color&gt;
      &lt;Color x:Key="ColorObjectBackground"&gt;#FFFFFF&lt;/Color&gt;
      &lt;Color x:Key="ColorTierOneText"&gt;#3c3c3c&lt;/Color&gt;
      &lt;Color x:Key="ColorTierTwoText"&gt;#999999&lt;/Color&gt;
  &lt;/ResourceDictionary&gt;   
  </code></pre>
  
  <p><strong>ListPage.xaml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:d="http://xamarin.com/schemas/2014/forms/design"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               xmlns:converter="clr-namespace:MyApp"
               mc:Ignorable="d"
               x:Class="MyApp.Views.ListPage" 
               Title="this is the title"&gt;
  
      &lt;ContentPage.BackgroundColor&gt;
          &lt;OnPlatform x:TypeArguments="Color"&gt;
              &lt;On Platform="GTK" Value="#3c3c3c" /&gt;
          &lt;/OnPlatform&gt;
      &lt;/ContentPage.BackgroundColor&gt;
  
      &lt;ContentPage.Resources&gt;
          &lt;ResourceDictionary Source="Styles/Colors.xaml"/&gt;
          &lt;!--&lt;ResourceDictionary&gt;
              &lt;converter:StatusToColorConverter x:Key="StatusToColorConverter" /&gt;
          &lt;/ResourceDictionary&gt;--&gt;
      &lt;/ContentPage.Resources&gt;
  
      &lt;StackLayout&gt;
          &lt;Label x:Name="NotFoundMessage"
                     IsVisible="False"
                     Text="No results found."
                     HorizontalTextAlignment="Center"
                     TextColor="ColorTierTwoText"
                     Padding="5"/&gt;
      &lt;/StackLayout&gt;  
  
      &lt;/ContentPage.Content&gt;
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p><strong>App.xaml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;Application xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:d="http://xamarin.com/schemas/2014/forms/design"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               mc:Ignorable="d"
               x:Class="MyApp.App"&gt;
  
  
      &lt;Application.Resources&gt;
          &lt;ResourceDictionary Source="Styles\Colors.xaml"/&gt;
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>