Languages

Menu
Sites
Language
How to move the cursor in Entry to the end?

I want that when opening a popup, in which there is an input field (Xamarin.Forms.Entry), the cursor immediately becomes at its end. So that the user does not do unnecessary actions to move the cursor

A very simple task, but I could not find a single solution.

I tried:

nameEntry.Focus();
nameEntry.CursorPosition = 10
nameEntry.Focus();
nameEntry.Text.Insert(0, app.GetName());
Edited by: Ivan Kudryavsky on 24 Apr, 2020
View Selected Answer

Responses

2 Replies
Ivan Kudryavsky

I found a solution:

nameEntry.Text = app.GetName();
nameEntry.CursorPosition = app.GetName().Length;
nameEntry.SelectionLength = 1;

 

 

Mark as answer
Ivan Kudryavsky

At the beginning:

nameEntry.Focus();

On the whole:

nameEntry.Focus();
nameEntry.Text = app.GetName();
nameEntry.CursorPosition = app.GetName().Length;
nameEntry.SelectionLength = 1;