GridUnitType 列舉
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
描述 GridLength 物件所持有的值種類。
public enum class GridUnitType
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class GridUnitType
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum GridUnitType
Public Enum GridUnitType
<object property="enumMemberName"/>
- 繼承
-
GridUnitType
- 屬性
Windows 需求
裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
欄位
Auto | 0 | 大小取決於內容物件的大小屬性。 |
Pixel | 1 | 此值以像素表示。 |
Star | 2 | 此值會表示為可用空間的加權比例。 |
範例
此範例示範如何將某些 TextBlock 物件和 Rectangle 放置在 Grid內。
<Grid >
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="36"/>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Margin="2" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3"
TextWrapping="Wrap">
This TextBlock is positioned in the first column and the
first row (column 0, row 0) and spans across all three columns (ColumnSpan 3).
</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="1" Margin="5" FontWeight="Bold">Rectangle:</TextBlock>
<Rectangle Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Left" Fill="Red"
Width="200" Height="50"/>
<Button Grid.Column="0" Grid.Row="2" Content="Stretched Button" />
<Border Background="Blue" BorderThickness="5" Grid.Row="2" Grid.Column="1" Grid.RowSpan="2" >
<TextBlock TextWrapping="Wrap">
This TextBlock spans across two rows.
</TextBlock>
</Border>
<TextBlock Margin="5" Grid.Row="3" Grid.Column="0">1st Column, 4th Row</TextBlock>
<TextBlock Margin="5" Grid.Row="3" Grid.Column="2">3rd Column, 4th Row</TextBlock>
</Grid>