I have a frame with 2 buttons and label. What is the best practice to make sure the frame and controls inside resize according to the screen size?
Whatever I have tried doesnt seem to do it!!! I thought that flexlayout could do it out of the box ,but cannot make it work.
I have used absolute layout to resize the frame.
Any suggestions
<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="Lavender">
<Frame Margin="20"
AbsoluteLayout.LayoutBounds="0.5,.05,0.9,0.4" AbsoluteLayout.LayoutFlags="All"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
BackgroundColor="WhiteSmoke"
BorderColor="DarkGray"
CornerRadius="10">
<FlexLayout
Padding="0"
AlignContent="Center"
AlignItems="Center"
Direction="Column"
JustifyContent="Center"
Wrap="NoWrap">
<Label Text="Label1" FontAttributes="Bold" FlexLayout.AlignSelf="Center" />
<Grid FlexLayout.AlignSelf="Center" ColumnSpacing="30">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Row="0"
Grid.Column="0"
Text="A"
MinimumHeightRequest="50"
MinimumWidthRequest="50"
HeightRequest="50"
WidthRequest="50"></Button>
<Button Grid.Row="0" Grid.Column="1"
Text="B"
MinimumHeightRequest="50"
MinimumWidthRequest="50"
HeightRequest="50"
WidthRequest="50" />
<Label Grid.Row="1" Grid.Column="0" Text="Label2" HorizontalTextAlignment="Center"></Label>
<Label Grid.Row="1" Grid.Column="1" Text="Label3" HorizontalTextAlignment="Center"></Label>
</Grid>
</FlexLayout>
</Frame>
</AbsoluteLayout>