マージンはコントロールの周囲に配置されるスペースの量であるため、マージンが機能しないのは当然のことです。ウィンドウの場合、これはクライアント領域ではなくフレームを小さくする(そしてオフセットする)ことを意味し、それは少し奇妙です(そして、Win32ホスティング環境ではうまく機能しないかもしれません、確かではありません)。パディングが機能しないのは少し驚きですが、なぜそうなるのかわかりません。
ただし、スタイルにカプセル化できる回避策があります。デフォルトのWindow ControlTemplateを、パディングを尊重する独自のテンプレートに置き換えます。
<ControlTemplate TargetType="Window">
<Border Background="White" Padding="{TemplateBinding Padding}">
<ContentPresenter />
</Border>
</ControlTemplate>
(おそらく、境界線の背景をプロダクションコードの動的なウィンドウの背景ブラシにしたいでしょうが、あなたはその考えを理解しています。)
もちろん、このテンプレートをスタイルテンプレートセッターに入れて、各ウィンドウで繰り返す必要がないようにすることができます。
完全なテンプレート(Microsoft Expressionで生成)は次のとおりです。
<Style x:Key="WindowStyle" TargetType="{x:Type Window}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Margin="{TemplateBinding Margin}"
Padding="{TemplateBinding Padding}">
<AdornerDecorator>
<ContentPresenter/>
</AdornerDecorator>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="ResizeMode" Value="CanResizeWithGrip">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<AdornerDecorator>
<ContentPresenter/>
</AdornerDecorator>
<ResizeGrip
x:Name="WindowResizeGrip"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
IsTabStop="false"
Visibility="Collapsed"
/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition
Property="ResizeMode"
Value="CanResizeWithGrip"
/>
<Condition
Property="WindowState"
Value="Normal"
/>
</MultiTrigger.Conditions>
<Setter
Property="Visibility"
TargetName="WindowResizeGrip"
Value="Visible"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>