dotnet / dotnet/maui

Picker control does not respect size imposed by parent.

Open
#7,243 5 comments 0 reactions 0 assignees View on GitHub
area-controls-picker platform/android platform/ios s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 10h
Merged PRs (30d)
297

Description

### Description

The Picker control does not limit its size to the limits specified by its parent. It should never become larger than the size allotted to it, but it does if the selected item text does not fit into the allotted size. In XF this did not happen so this appears to be a regression.

When the selected item text does not fit into the allotted size, then ellipses or truncation should be used to prevent increasing the control size. Under some circumstances, Android does proper sizing of the Picker and truncates the text, but I could not make that work in the repro either.

Additionally, using the middle "*" column has an even stranger effect of apparently making the middle column width negative (the Pickers moves to the left). Also depending on the parent layout the Picker can overextend to the left or to the right.

### Steps to Reproduce

1. Build and run the repro sample under Android and iOS
2. On both platforms the white Picker control extends beyond the bounds of the parents:

![image](https://user-images.githubusercontent.com/6193288/168725914-ef0687b8-eefa-4287-839c-64179386ec9d.png)
[layoutbug13.zip](https://github.com/dotnet/maui/files/8705054/layoutbug13.zip)

### Version with bug

Release Candidate 3 (current)

### Last version that worked well

Unknown/Other

### Affected platforms

iOS, Android

### Affected platform versions

Android 11, iOS 15

### Did you find any workaround?

no

### Relevant log output

_No response_

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.