Reputation:
I have a problem. I created a Frame in my page using this code:
<Grid BackgroundColor="#212121">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid Grid.Row="1" Margin="20, 0, 20, 0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition Height="50" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image Source="Logo.png" HeightRequest="200" VerticalOptions="End" Margin="30" />
<Entry Grid.Row="1" Placeholder="Username" PlaceholderColor="#bababa" FontSize="16" x:Name="txtUsername" TextColor="White" />
<Entry Grid.Row="2" Placeholder="Email" PlaceholderColor="#bababa" FontSize="16" x:Name="txtEmail" TextColor="White" />
<Entry Grid.Row="3" Placeholder="Password" PlaceholderColor="#bababa" FontSize="16" IsPassword="True" x:Name="txtPassword" TextColor="White" TextChanged="OnPasswordTextChanged" />
<Frame Grid.Row="4" BackgroundColor="Transparent" BorderColor="Transparent" x:Name="FramePasswordStrength" >
<Label Text="Test" BackgroundColor="Purple" TextColor="White" HorizontalOptions="Center" VerticalOptions="Center" x:Name="txtPasswordStrength" FontSize="14" />
</Frame>
<Entry Grid.Row="5" Placeholder="Confirm Password" PlaceholderColor="#bababa" FontSize="16" IsPassword="True" x:Name="txtConfirmPassword" TextColor="White" />
<Button Text="Sign up" FontAttributes="Bold" Clicked="btnRegisterClicked" BackgroundColor="#3897F0" TextColor="White" HeightRequest="50" VerticalOptions="Start" Grid.Row="6" />
</Grid>
</Grid>
The problem is that my frame get drawn the way I want, but there is no label in the center of that Frame. Now I already tried to reduce the FontSize, but that doesn't work.
What am I doing wrong?
Upvotes: 1
Views: 1747
Reputation: 176
The actual issue is Frame having the default padding of 20 to displaying its child element into frame effects. To fix your issue, by adjusting the padding.
Upvotes: 2
Reputation: 5768
Try to set <RowDefinition Height="Auto" />
to row's height so it should has the correct height for all controls.
You can also set Frame's VerticalLayout
and HorizontalLayout
to FillAndExpand
Upvotes: 2