内部にいくつかの要素を持つグリッドがあります:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="SomeText" Grid.Column="0" Grid.Row="0" />
<TextBox Grid.Column="1" Grid.Row="0" />
<TextBlock Text="SomeText" Grid.Column="0" Grid.Row="1" />
<TextBox Grid.Column="1" Grid.Row="1" />
<TextBlock Text="SomeText" Grid.Column="0" Grid.Row="2" />
<TextBox Grid.Column="1" Grid.Row="2" />
</Grid>
問題は、それがきつく見えることです:
Margin プロパティはこの問題を解決しますが、このプロパティをグリッド内の各要素に設定する必要があります。それは難しい方法です。
要素ごとではなく、一度だけマージンプロパティを設定するようなものを取得したい: