Xamarin Forms Editor Control – How to Change the Height Dynamically ?

Xamarin Forms Editor Control – How to Change the Height Dynamically ?


When I was trying to create a UI with a multi-line editor control in Xamarin Forms, I got an issue that It does not extend its height when I was adding multiple lines like in Android message app, Whatsapp etc..

His is my first XAML code which I tried before solve the issue.

Project Structure

Image 1 : Project Structure


Image 2 : With Default Editor control

In this UI, you can see that is does not extend its height when enter multiple lines.

Here is the code before customizing the editor.

first code

Then I looked for a solution for how to do it..


The solution is adding a custom render. Inside the custom render, we have to call InvalidateMeasure() method inside the TextChanged event to invalidate the layout of this Xamarin.Forms.VisualElement.

invalidate mesasure

Image 3 : InvalidateMeasure method definition

Thanks @JulianPasquefor the solution.

How to add the custom render for the Editor in the app.

First I’ll create a class EditorXF inside the CustomRenderer folder. and inherit Xamarin.Forms.Editor class to the EditorXF.

Then create a constructor for  EditorXF and create an event for TextChanged and call InvalidateMeasure() inside the event.

dynamicEditor render

Image 4 : Editor Custom Render

Then what we have to do is, call the customized render in the XAML code of the View.

First we have to add the namespace of the EditorXF render in the XAML Vew.

renderer xaml

Image 5 : Add XML namespace  of the Custom Render

Then Change the replace the Editor control by EditorXF render control using local:EditorXF tag.


Image 6 : Call Customized Editor in Vew

Then run the app and we will be able to add multiple lines and extend the height of the editor control dynamically.


Image 7 : Extended Editor

You can Have the full solution here @GitHub ..


Enjoy !!!!   






How to Fix Error : Xamarin.Forms.Xaml.XamlParseException: Position 39:8. Type local:NoBorderEntry not found in xmlns clr-namespace:LoginApp;assembly=LoginApp

Why ?

I created a sample login form using Xamarin  and I wanted to remove the underline of the Entry controls. So I had to use a custom render to change the Entry Control .

Below Image describes what I was going to do…


So I wrote a custom render to customize the Entry Control in Android(Droid) project and when I was trying to run the app , It gave me an exception that..

Xamarin.Forms.Xaml.XamlParseException: Position 39:8.

Type local:NoBorderEntry not found in xmlns clr-namespace:LoginApp; assembly=LoginApp


How to Solve the issue ?

So I  looked for a solution and I found the issue is in the assembly name that I have defined in the XAML file.

What I had to do is change the assembly name.


Now I’ll describe you what was the wrong and How did I solve the issue..

First to learn How to write a custom render for Entry Control, Click here …

Here is the architecture of my app..


My code..

NoBorderEntry  Class

using Xamarin.Forms;

namespace LoginApp
public class NoBorderEntry : Entry


NoBorderEntryEntryRenderer Class

using Android.Graphics.Drawables;
using LoginApp;
using LoginApp.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;

[assembly: ExportRenderer(typeof(NoBorderEntry), typeof(NoBorderEntryEntryRenderer))]
namespace LoginApp.Droid
public class NoBorderEntryEntryRenderer : EntryRenderer
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)

if (Control != null)
Control.Background = new ColorDrawable(Android.Graphics.Color.Transparent);




The XAML code is too large in my file. SO I’ll write only the important parts of the XAML code..

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
x:Class="LoginApp.MainPage" >

<local:NoBorderEntry Grid.Row="0"  Grid.Column="1"  Placeholder="User Name"  PlaceholderColor="Silver" TextColor="#D6FCE6" />


And here you can see the namespace that I have declared and how we can use it to the Entry render..


You can see the highlighted texts in above images and according to them the namespace in the NoBorderEntryRenderer is “LoginApp.Droid” but in the in the MainPage.Xaml file the assembly name id “LoginApp”.

So “assembly=LoginApp” should me changed to “assembly=LoginApp.Droid” and the Error will be fixed.


Then the correct XAML namespace declaration should be like below..

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms&quot;
x:Class="LoginApp.MainPage" >


Now the app will run without any error…





Thanks !