How to bring the cursor to the end of text in the textbox control – WPF C#

Normally if we focus a textbox control the cursor would be in the start of the textbox.But when there is text already in the textbox it would be annoying if the cursor is in start.It would be better if the cursor is at the end of content in texbox.

Thus to position the cursor at the end of the text content of a textBox control,we have to call the select method and specify the selection start position to the length of the text and a selection length to 0.

txtExample.Select(txtExample.Text.Length, 0);

Ref : msdn

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>