语言

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());
编辑者为: Ivan Kudryavsky 24 4月, 2020
查看选择的答案

响应

2 回复
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;