我有一个网格,我希望它填满屏幕。 我可以使用水平选项吗?例如?
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Image="imgteste.png" Grid.Row="0" Grid.Column="0"></Button>
<Label Text="User name:" Grid.Row="0" Grid.Column="1"></Label>
<Label Text="User name:" Grid.Row="1" Grid.Column="0"></Label>
<Label Text="User name:" Grid.Row="1" Grid.Column="1"></Label>
</Grid>
答案 0 :(得分:1)
您需要像想象的那样添加HorizontalOptions
和VerticalOptions
。
<Grid HorizontalOptions="Fill"
VerticalOptions="Fill">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Image="imgteste.png" Grid.Row="0" Grid.Column="0"></Button>
<Label Text="User name:" Grid.Row="0" Grid.Column="1"></Label>
<Label Text="User name:" Grid.Row="1" Grid.Column="0"></Label>
<Label Text="User name:" Grid.Row="1" Grid.Column="1"></Label>
</Grid>