Skip to content
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 *STILL* not measured correctly #13683

Open
@JohnHDev

Description

@JohnHDev

Original bug that was 'fixed' after 8 months and we broke in 10 minutes: #8797

Original bug is being ignored as people go off and work on the new and shiny. But sure, I'll raise a new bug for this. I clearly have more free time than those working for MS, so why not.

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
Install Xamarin Community Toolkit Markup nuget
Replace the code with the following and fix the namespace accordingly:

public class MainPage: ContentPage
{
    public MainPage()
    {
        BackgroundColor = Color.Gray;

        Content = new StackLayout()
        {
            Padding = new Thickness(10, 40, 10, 10),
            Children =
            {
                new Grid()
                {
                    ColumnSpacing = 8,
                    ColumnDefinitions =
                    {
                        new ColumnDefinition() { Width = GridLength.Auto },
                        new ColumnDefinition() { Width = GridLength.Star },
                    },

                    Children =
                    {
                        new Grid()
                        {
                            RowSpacing = 0,
                            Children =
                            {
                                new Label()
                                {
                                    Text = "ABC123"
                                }
                            }
                        }.Row(0).Column(0),
                        new Frame()
                        {
                            Margin = 0,
                            Padding = 0,
                            CornerRadius = 8,
                            HasShadow = false,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            Content = new Grid()
                            {
                                ColumnSpacing = 0,
                                VerticalOptions = LayoutOptions.CenterAndExpand,
                                ColumnDefinitions =
                                {
                                    new ColumnDefinition() { Width = GridLength.Auto },
                                    new ColumnDefinition() { Width = GridLength.Star },
                                },
                                RowDefinitions =
                                {
                                    new RowDefinition() { Height = GridLength.Auto }
                                },
                                Children =
                                {
                                    new Label()
                                    {
                                        Margin = new Thickness(6, 3, 6, 3),
                                        VerticalOptions = LayoutOptions.CenterAndExpand,
                                        Text = "dfg fg df dfg dfg dfg f dfg dfg dfg dff gdf gdf gd fg dfg df gdf g df gd gdf gf dg ffd gdf gdf g df gdf gd fg df gdg df dfg a"
                                    }.Row(0).Column(1)
                                }
                            }
                        }.Row(0).Column(1)
                    }
        }
            }
        };
    }
}

Run it.

Expected Behavior

Label should display correctly, with all the text visible.

Actual Behavior

Label is wrapping out of the grid.

Basic Information

  • Version with issue: XF 5.0.0
  • Last known good version: Has there ever been a 'good' Xamarin Forms version?
  • Platform Target Frameworks:
    • iOS: 14.4

Workaround

Migrate all projects to Flutter

Metadata

Metadata

Assignees

No one assigned

    Labels

    a/labela/layouti/highCompletely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less oftent/bug 🐛

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions