Forms9Patch icon indicating copy to clipboard operation
Forms9Patch copied to clipboard

Text on Label and Entry not Autofitting to width

Open tpitman opened this issue 2 years ago • 1 comments

Description

I have a Xamarin.Forms app developed on Visual Studio for Mac 2019. I am using the Forms9Patch:Label and Entry controls. They are not changing the font size when Autofit="Width" is used. I have tried putting them as the root content, or in stacklayouts or grids and nothing seems to work.

Steps to Reproduce

  1. Add Forms9Patch:Label
  2. Set Autofit to Width
  3. Notice when the width of the control is smaller than will fit with the requested font size the font size does not reduce to fit.

Expected Behavior

Font should be reduced in size to fit to the width of the control

Actual Behavior

Text word wraps onto 2 lines OR if MaxLines is set to 1, the text is cut off.

Basic Information

  • Version with issue: 2.4.9
  • Last known good version: ?
  • IDE: Visual Studio for Mac 2019
  • Platform Target Frameworks:
    • iOS: All
    • Android: All

Screenshots

<Forms9Patch:Label Grid.Row="0" Grid.Column="0" AutoFit="Width" Text="Target Energy (millijoules)" VerticalTextAlignment="Center" FontSize="22" BackgroundColor="Transparent"/>

That line produces this output (note that Target Energy (millijoules) should be on one line):

simulator_screenshot_07D6C9C1-E7BF-44CE-AA73-0ACAA13FC19B

tpitman avatar Feb 10 '22 19:02 tpitman

In your example, what if you add Lines="1"? I just started trying this library and that was needed for my similar situation.

rokenbuzz avatar Feb 22 '22 04:02 rokenbuzz