I am using Xamarin Forms in Visual Studio 19, and I'm trying to add a few items to a Grid element and have them placed next to each other in a row. I am putting this inside a ContentPage.Content element.
I've tried using a Stacklayout, setting the Horizontaloptions of the buttons (setting them all to "start" just makes them overlap, setting one to start one to center and one to end would work but I want to put more than 3 buttons on the makeshift Grid Toolbar.). It's telling me I'm getting an error when I try to make some columndefinitions for the grid too, saying that contentpage doest not support direct content.
This is my columndefinitions section
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*/>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="20*"/>
</Grid.ColumnDefinitions>
and I'm setting the columns of my buttons the normal way.
<ContentPage.Content>
<Grid BackgroundColor="blue"
HeightRequest="60"
VerticalOptions="End" >
<ImageButton Source="alarm.png"
HeightRequest="25"
WidthRequest="25"
HorizontalOptions="StartAndExpand"
/>
<ImageButton Source="alarm.png"
HeightRequest="25"
WidthRequest="25"
HorizontalOptions="EndAndExpand"
/>
</Grid>
</ContentPage.Content>
Also, How do I remove the grey button background? Edit 02/05/2020
To remove the grey background square, set BackgroundColor="transparent"