dotnet / dotnet/docs-maui

Not using Expand on Label within grid cuts off text

Open
#2,884 0 comments 0 reactions 0 assignees View on GitHub
:watch: Not Triaged dotnet-maui/subsvc dotnet-mobile/svc Pri2
Dominant language
No language data
Stars
282
Forks
265
Avg merge
2d 2h
Merged PRs (30d)
19

Description

### 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](https://github.com/dotnet/docs-maui/issues?q=is%3Aissue+is%3Aopen+d1b3caad-9e6a-2e13-ea1b-27ce71398ca1)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.