简体   繁体   中英

How to set TextBox cursor on the rigth corner of the TextBox

How to set TextBox cursor on the right corner of the TextBox .

像这样:

While there's a Text inside the TextBox

You can use HorizontalContentAlignment property:

<TextBox HorizontalContentAlignment="Right" VerticalAlignment="Top"/>

The result:

在此处输入图片说明

If you want to set the Caret position, you have to play with CaretIndex property,for example:

<TextBox Text="Username" CaretIndex="0"/>;

But as @NicoRiff says in a comment, what you probably want is a PlaceHolder. If that's the case, see this question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM