title: How to remove the default margin on the content of a wpf TabItem in C# Code
body: <p>I'm using the TabControl class in WPF and I've noticed that the content of each TabItem has a default margin of 4 pixels on all sides.</p>
  
  <p>I'm building the Tab Control Dynamically in C# code, but I've only seen the XAML solution below. How is this achievable in C# code or Templating.</p>
  
  <pre><code>&lt;TabItem&gt;
    &lt;Grid Margin="-4"&gt;
    &lt;/Grid&gt;
  &lt;TabItem&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/zTkdY.png" alt="Tab Border"></p>