我有一个有 14 列的网格。如果我在第一个网格的第一列中放置另一个 28 列的网格并将其跨越 14,它将每列分成两部分。但是,如果我创建 42 列(3x14)的网格,它不会将每一列拆分为三个 eaqul 部分。
这个有效:
这不起作用(不均分):
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SilverlightApplication1.MainPage"
Width="640" Height="480">
<Grid x:Name="LayoutRoot" Background="White">
<Grid x:Name="AllWhiteKeys" Margin="0,0,0,200">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Name="WhiteKey1" Grid.RowSpan="3" Grid.Column="0" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey2" Grid.RowSpan="3" Grid.Column="1" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey3" Grid.RowSpan="3" Grid.Column="2" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey4" Grid.RowSpan="3" Grid.Column="3" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey5" Grid.RowSpan="3" Grid.Column="4" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey6" Grid.RowSpan="3" Grid.Column="5" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey7" Grid.RowSpan="3" Grid.Column="6" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey8" Grid.RowSpan="3" Grid.Column="7" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey9" Grid.RowSpan="3" Grid.Column="8" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey10" Grid.RowSpan="3" Grid.Column="9" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey11" Grid.RowSpan="3" Grid.Column="10" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey12" Grid.RowSpan="3" Grid.Column="11" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey13" Grid.RowSpan="3" Grid.Column="12" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Rectangle Name="WhiteKey14" Grid.RowSpan="3" Grid.Column="13" Fill="White" StrokeThickness="1" Stroke="Black" RadiusX="8" RadiusY="8"/>
<Grid Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="14">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
</Grid>
</Grid>