How to remove the default margin on the content of a wpf TabItem in C# Code -
    i'm using tabcontrol class in wpf , i've noticed content of each tabitem has default margin of 4 pixels on sides.   i'm building tab control dynamically in c# code, i've seen xaml solution below. how achievable in c# code or templating.   <tabitem>   <grid margin="-4">   </grid> <tabitem>            you have assign grid id, example (pertinent case):     <grid name ="grd">   </grid>   then apply margin spec following:   grd.margin = new thickness(-4);   also, can use variation of syntax:   grd.margin = new thickness(-4,-4,-4,-4);   the same technique can apply other controls. read more on topic (wpf margin) at: https://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.margin.aspx   hope help.