Xamarin forms Editor AutoSize does not work

Viewed 4845

Im I just misunderstanding the name "AutoSize"-property on the Editor-control or does it simply not work?

I have a control like this in xaml:

<Editor AutoSize="TextChanges" HeightRequest="100"/>

It comes out fine at height 100, but when I have written a few rows it does not change size/height. The upper text is simply scrolled up.

2 Answers

In case you want AutoSize to work and at the same time to have height of 100, you can do something like this:create a new class that inherits Editor, override method below and use a new class instead on your page

protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
{
     var sizeRequest = base.OnMeasure(widthConstraint, heightConstraint);

     return new SizeRequest(new Size(sizeRequest.Request.Width, Math.Max(100, sizeRequest.Request.Height)));
}
Related