Andr谩s T贸th‘s professional blog
banditoth.net

Hey there 馃憢, I’m banditoth a .NET MAUI developer from Hungary.
I write about software development with .NET technologies.

You can find me on:
LinkedIn | Github | StackOverflow | X / Twitter | Threads

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

This content has 3 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

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 Reply

Your email address will not be published. Required fields are marked *

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