XAML でマージン プロパティを設定し、それらを から取得したい Grid コントロールがありますSystemInformation.CaptionHeight
。C# でそれを行う方法を理解しましたが、XAML で行いたいと思います。
リソースを使用してこのような設定を行ったことはありませんが、次のようなバリエーションを試しました
<Grid>
<Grid.Margin>
<Thickness Top="{StaticResource {x:Static Forms:SystemInformation.CaptionHeight}}" Left="5" Right="5" Bottom="5" />
</Grid.Margin>
</Grid>
と
<Grid>
<Grid.Margin>
<Thickness Top="{x:Static Forms:SystemInformation.CaptionHeight}" Left="5" Right="5" Bottom="5" />
</Grid.Margin>
</Grid>
しかし、役に立たない。実行時にこのような属性を動的に設定するにはどうすればよいですか?