title: Why does TextBox get a padding when Grid.Margin is set in App.xaml?
body: <p>A simple window:</p>
  
  <pre><code>&lt;Window x:Class="MyApp.MainWindow" xmlns="..." xmlns:x="..."&gt;
  
  &lt;Window.Resources&gt;
      &lt;Style TargetType="Grid"&gt;
          &lt;Setter Property="Margin" Value="8"/&gt;
      &lt;/Style&gt;
  &lt;/Window.Resources&gt;
  
  &lt;Grid&gt;
      &lt;TextBox VerticalAlignment="Top" HorizontalAlignment="Left"&gt;Test&lt;/TextBox&gt;
  &lt;/Grid&gt;
  
  &lt;/Window&gt;
  </code></pre>
  
  <p>It looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/Yn3s2.png" alt=""></p>
  
  <p>Now we remove <code>Window.Resources</code>:</p>
  
  <pre><code>&lt;Window x:Class="MyApp.MainWindow" xmlns="..." xmlns:x="..."&gt;
  &lt;Grid&gt;
      &lt;TextBox VerticalAlignment="Top" HorizontalAlignment="Left"&gt;Test&lt;/TextBox&gt;
  &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>And add the style definition to <code>App.xaml</code>:</p>
  
  <pre><code>&lt;Application x:Class="MyApp.App" xmlns="..." xmlns:x="..." StartupUri="View\MainWindow.xaml"&gt;
  &lt;Application.Resources&gt;
      &lt;Style TargetType="Grid"&gt;
          &lt;Setter Property="Margin" Value="8"/&gt;
      &lt;/Style&gt;
  &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p>Strangely, the TextBox now gets a padding:</p>
  
  <p><img src="https://i.stack.imgur.com/u39o3.png" alt=""></p>
  
  <p>Why?</p>