Hello,
I'm new to Xamarin and currently trying to move my Android activity to a Xamarin Content Page. The activity contains a grid (few linear layouts) of square shaped buttons of equal size - I would post a screenshot, but this page doesn't allow me to - ,,you have to be around for a little longer to post links"... That's also the reason why I had to remove xmnls references. That's pretty annoying to be honest.
I've written a following piece of XAML code:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="..."
xmlns:x="..."
x:Class="TravelGuide.MainPage">
<ContentPage.Content>
<ScrollView>
<Grid x:Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Text="Text..."
x:Name="btn1"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
HeightRequest="{Binding Width, Source={x:Reference btn1}}"
Grid.Row="0"
Grid.Column="0"/>
<Button Text="Text2..."
x:Name="btn2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
HeightRequest="{Binding Width, Source={x:Reference btn2}}"
Grid.Row="0"
Grid.Column="1"/>
<Button Text="Text3..."
x:Name="btn3"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
HeightRequest="{Binding Width, Source={x:Reference btn3}}"
Grid.Row="0"
Grid.Column="2"/>
</Grid>
</ScrollView>
</ContentPage.Content>
Unfortunately, it doesn't work if I put a long text inside of a button - the button automatically resizes to fit the text.
How to prevent that?