Xamarin.Forms : Focus to the entry and set the cursor after the last character

If you want to make the cursor in Xamarin.Forms Entry blink behind the text you have already typed, instead of in front of it, after focusing, you need to do the following:

Subscribe to the Focused event of the Entry and modify the eventhandler as follows:

		public void OnEntryFocused(object sender, EventArgs args)
			EntryInstance.CursorPosition = EntryInstance?.Text?.Length ?? 0;

You can find more information about the CursorPosition at: https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.entry.cursorposition?view=xamarin-forms

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.