I am trying to make 9 square buttons in a grid (picture of what I have so far is below). I am using Xamarin Forms with Visual Studio 2019. It seems no matter what I do, I am always getting 8 square buttons and 1 rectangle button. Any suggestions?
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Chess_test13.MainPage">
<StackLayout>
<Grid Padding="50,50" RowSpacing="0" ColumnSpacing="0" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:Name="00" ClassId="00" PropertyChanged="PropertyChanged" Text="" Grid.Row="0" Grid.Column="0" BackgroundColor="Transparent" Clicked="buttonClick" VerticalOptions="CenterAndExpand" HorizontalOptions="Fill" HeightRequest="{Binding Width,Source= {x:Reference 00}}" />
<Button x:Name="01" ClassId="01" PropertyChanged="PropertyChanged" Text="" Grid.Row="0" Grid.Column="1" BackgroundColor="Transparent" Clicked="buttonClick" VerticalOptions="CenterAndExpand" HorizontalOptions="Fill" HeightRequest="{Binding Width,Source= {x:Reference 01}}" />
<Button x:Name="02" ClassId="02" PropertyChanged="PropertyChanged" Text="" Grid.Row="0" Grid.Column="2" BackgroundColor="Transparent" Clicked="buttonClick" VerticalOptions="CenterAndExpand" HorizontalOptions="Fill" HeightRequest="{Binding Width,Source= {x:Reference 02}}" />
<Button x:Name="10" ClassId="10" PropertyChanged="PropertyChanged" Text="" Grid.Row="1" Grid.Column="0" BackgroundColor="Transparent" Clicked="buttonClick" VerticalOptions="CenterAndExpand" HorizontalOptions="Fill" HeightRequest="{Binding Width,Source= {x:Reference 10}}" />
<Button x:Name="11" ClassId="11" PropertyChanged="PropertyChanged" Text="" Grid.Row="1" Grid.Column="1" BackgroundColor="Transparent" Clicked="buttonClick" VerticalOptions="CenterAndExpand" HorizontalOptions="Fill" HeightRequest="{Binding Width,Source= {x:Reference 11}}" />
<Button x:Name="12" ClassId="12" PropertyChanged="PropertyChanged" Text="" Grid.Row="1" Grid.Column="2" BackgroundColor="Transparent" Clicked="buttonClick" VerticalOptions="CenterAndExpand" HorizontalOptions="Fill" HeightRequest="{Binding Width,Source= {x:Reference 12}}" />
<Button x:Name="20" ClassId="20" PropertyChanged="PropertyChanged" Text="" Grid.Row="2" Grid.Column="0" BackgroundColor="Transparent" Clicked="buttonClick" VerticalOptions="CenterAndExpand" HorizontalOptions="Fill" HeightRequest="{Binding Width,Source= {x:Reference 20}}" />
<Button x:Name="21" ClassId="21" PropertyChanged="PropertyChanged" Text="" Grid.Row="2" Grid.Column="1" BackgroundColor="Transparent" Clicked="buttonClick" VerticalOptions="CenterAndExpand" HorizontalOptions="Fill" HeightRequest="{Binding Width,Source= {x:Reference 21}}" />
<Button x:Name="22" ClassId="22" PropertyChanged="PropertyChanged" Text="" Grid.Row="2" Grid.Column="2" BackgroundColor="Transparent" Clicked="buttonClick" VerticalOptions="CenterAndExpand" HorizontalOptions="Fill" HeightRequest="{Binding Width,Source= {x:Reference 22}}" />
</Grid>
</StackLayout>
</ContentPage>
RowSpacing
andColumnSpacing
to bigger values, I also changed the button names to start with letters. other than that it's showing 3x3 identical squares – mshwf