XAML代码示例:
<Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="4" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="4" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <TextBlock Text="test" Grid.Column="0" Grid.Row="0" /> <TextBlock Text="test" Grid.Column="0" Grid.Row="2" /> <TextBlock Text="test" Grid.Column="2" Grid.Row="0" /> <TextBlock Text="test" Grid.Column="2" Grid.Row="2" /> </Grid>
即在内容行(或列)之间插入指定高度(或宽度)的空白行(或列),以实现CellPadding的效果。