我偶然发现了我的网格问题,不完全是网格,而是网格内的按钮。他们不会填满整个空间,我搜索了一个解决方案,但我找到的唯一一个是HorizontalAlignment =" Stretch",它似乎不起作用(不是命令或属性) XAML)。
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="PersonalSoundboard.Page1">
<ContentPage.Content>
<StackLayout>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Grid.Column="0" Grid.Row="0" Text="button 1"> </Button>
<Button Grid.Column="0" Grid.Row="1" Text="button 2"> </Button>
<Button Grid.Column="0" Grid.Row="2" Text="button 3"></Button>
<Button Grid.Column="1" Grid.Row="0" Text="button 4"></Button>
<Button Grid.Column="1" Grid.Row="1" Text="button 5"></Button>
<Button Grid.Column="1" Grid.Row="2" Text="button 6"></Button>
<Button Grid.Column="2" Grid.Row="0" Text="button 7"></Button>
<Button Grid.Column="2" Grid.Row="1" Text="button 8"></Button>
<Button Grid.Column="2" Grid.Row="2" Text="button 9></Button>
</Grid>
</StackLayout>
</ContentPage.Content>
</ContentPage>