Pavel Durov
Pavel Durov

Reputation: 1297

Cursor position in xaml textbox control

Is there a way to align cursor position in Textbox XAML control?

I have this Textbox:

enter image description here

As you can see the Cursor is slightly upper than the middle position. Is there any way to fix it? Or any work around for this issue?

That's happening in Windows Phone 8.1 platform, however on UWP the Textbox cursor perfectly centered.

Upvotes: 2

Views: 1323

Answers (2)

Pavel Durov
Pavel Durov

Reputation: 1297

I've added Padding="8,3,0,0" which sets the cursor in the middle (as a workaround) If anyone has better idia I would love to hear it :)

This solution sets the cursor in the middle, but the text isn't centered now...

Upvotes: 0

MathieuJourdan
MathieuJourdan

Reputation: 46

To Center the text in a TextBox use the VerticalContentAlignment Property of the TextBox.

<TextBox Text="The text" Height="40" VerticalContentAlignment="Center" />

Upvotes: 3

Related Questions