Skip to content

Not using Expand on Label within grid cuts off text #2884

Open
@mattallscripts

Description

@mattallscripts

Type of issue

Code doesn't work

Description

Description

I am experiencing an issue with a Label inside a Grid in .NET MAUI. When I set HorizontalOptions to End, the Label is cut off and doesn't fill the cell space. However, when I use EndAndExpand, the Label fills the cell space properly and all the text is shown. Despite this, I receive a warning in the XAML: "'EndAndExpand' is obsolete: The 'StackLayout' expansion options are deprecated; please use a Grid instead." But I am already using a Grid.

Documentation states that Expand options have no affect inside a Grid, but that's not the case.

Steps to Reproduce:

Create a Grid with two columns (,) and a label inside each column with text that should fill each the label.
Set HorizontalOptions to End for the Label.
Observe that the Label is cut off and doesn't fill the cell space.
Change HorizontalOptions to FillAndExpand.
Observe that the Label fills the cell space properly, but a deprecation warning is shown.

Expected Behavior:

The Label should fill the cell space properly without using the deprecated FillAndExpand option.

Actual Behavior:

The Label is cut off when using End, and a deprecation warning is shown when using FillAndExpand.

Page URL

https://learn.microsoft.com/en-us/dotnet/maui/migration/layouts?view=net-maui-9.0

Content source URL

https://github.com/dotnet/docs-maui/blob/main/docs/migration/layouts.md

Document Version Independent Id

d1b3caad-9e6a-2e13-ea1b-27ce71398ca1

Platform Id

dd9f6558-d439-d961-097f-a07eefbd164d

Article author

@davidbritch

Metadata

  • ID: d1b3caad-9e6a-2e13-ea1b-27ce71398ca1
  • PlatformId: dd9f6558-d439-d961-097f-a07eefbd164d
  • Service: dotnet-mobile
  • Sub-service: dotnet-maui

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions