This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.
[Bug] Word wrapped Label not measured correctly #8797
Closed
Description
Description
A Label in a grid that is contained in a StackLayout isn't measured correctly, with contents below the grid in the StackLayout overlapping the grid and label.
Steps to Reproduce
- Create a new template XF solution.
- Replace the MainPage xml with a new MainPage.cs
- Replace the code with the following and fix the namespace accordingly:
using System;
using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
namespace LabelSizeTest
{
public class MainPage : ContentPage
{
public MainPage()
{
On<iOS>().SetUseSafeArea(true);
var grid = new Grid();
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
var label = new Label();
label.LineBreakMode = LineBreakMode.WordWrap;
label.Text = "This is a test teest test 2nd 3rd last";
grid.Children.Add(label, 1, 0);
var stack = new StackLayout()
{
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
};
stack.Children.Add(new BoxView()
{
BackgroundColor = Color.Blue,
HeightRequest = 50
});
stack.Children.Add(grid);
stack.Children.Add(new BoxView()
{
BackgroundColor = Color.Blue,
HeightRequest = 50
});
Content = stack;
}
}
}
- Run on the iPhone 11 Simulator.
Expected Behavior
Label should display correctly, with all the text visible.
Actual Behavior
Label is being partially obscured by the 2nd BoxView, the words 3rd and Last are replaced with the BoxView.
Basic Information
-
Version with issue:
-
Last known good version:
-
IDE: VS4Mac
-
Platform Target Frameworks:
- iOS:
-
Nuget Packages: XF 4.2.0
-
Affected Devices: