title: Global styles from App.xaml applying in designer but not at runtime as of recently
body: <p><strong>Problem</strong></p>
  
  <p>I am working on an application, and recently I reorganized the file structure as I was adding more parts. Around this time I noticed that at runtime, styles from my App.xaml weren't getting applied. I made a lot of code changes at once before building so I am unsure of what may have changed.</p>
  
  <p><strong>Information</strong></p>
  
  <p>App.xaml remained unchanged before it stopped getting applied.</p>
  
  <p>My program is laid out to have a main <code>&lt;ContentControl&gt;</code> that I bind some views to for some MVVM action. Originally I had all my views for different subfunctions of my program in one Views folder, but individual parts were getting too large so I split them up from this:</p>
  
  <pre><code>&lt;Project&gt;/Models
  &lt;Project&gt;/ViewModels
  &lt;Project&gt;/Views
  </code></pre>
  
  <p>to</p>
  
  <pre><code>&lt;Project&gt;/EventEditor/Models
  &lt;Project&gt;/EventEditor/ViewModels
  &lt;Project&gt;/EventEditor/Views
  &lt;Project&gt;/ConfigurationEditor/Models
  &lt;Project&gt;/ConfigurationEditor/ViewModels
  &lt;Project&gt;/ConfigurationEditor/Views
  </code></pre>
  
  <p>My UserControl doesn't have any resources or styles of its own and should only be using the ones from App.xaml for now.</p>
  
  <p>I only have 1 App.xaml file and no other files containing styles/dictionaries/etc outside of the individual view XAMLs.</p>
  
  <p>Here is my App.xaml:</p>
  
  <pre><code>&lt;Application x:Class="EventSuite.App"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:local="clr-namespace:EventSuite"
           StartupUri="MainWindow.xaml"&gt;
  &lt;Application.Resources&gt;
      &lt;!-- Global Styles --&gt;
      &lt;Style TargetType="ListBoxItem"&gt;
          &lt;Setter Property="FontSize" Value="14" /&gt;
      &lt;/Style&gt;
      &lt;Style TargetType="TextBlock"&gt;
          &lt;Setter Property="FontSize" Value="14" /&gt;
      &lt;/Style&gt;
      &lt;Style TargetType="Label"&gt;
          &lt;Setter Property="FontSize" Value="14" /&gt;
      &lt;/Style&gt;
      &lt;Style TargetType="Button"&gt;
          &lt;Setter Property="Margin" Value="2,0,2,0"/&gt;
          &lt;Setter Property="Padding" Value="2"/&gt;
          &lt;Setter Property="FontSize" Value="14"/&gt;
      &lt;/Style&gt;
  &lt;/Application.Resources&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Steps Taken</strong></p>
  
  <ol>
  <li>Clean build/rebuild</li>
  <li>Breaking and using Tree Visualizer to investigate (no luck there)</li>
  <li>Diffing files/projects. Nothing that I found could be causing this (I don't know exactly what to be looking for)</li>
  </ol>
  
  <p><strong>Questions</strong></p>
  
  <ol>
  <li>Is there a way to debug styles which are being used? I tried the WPF Tree Visualizer and it showed <code>null</code> for Style on my buttons, which is what I would expect since I didn't explicitly set any style.</li>
  <li>Could file structure have a role to play? Perhaps App.xaml isn't being read correctly, or it's not being applied correctly. I haven't seen any warnings or indications of failure.</li>
  <li>Namespace related? I would hope not...</li>
  </ol>
  
  <p>In summary I am a little lost as to why App.xaml applies in design time and not at runtime. Why could this be happening after some changes to my project. I am lost! Let me know if you need more information or examples.</p>