Member 13486187 Ответов: 2

Сделайте заглавные буквы текстового значения textbox в UWP, каково его решение?


I have used ToUpper to make capital letters in TextBox in UWP but getting issue of Cursor position in that Any other solution for it ?

What I have tried:

<pre>I have tried ToUpper, CharacterCasing and Typography.Capitals from which only ToUpper working other two are showing not accessible in textbox and for ToUpper i am facing problem for selectionStart posistion of cursor.

<TextBox x:Name="txt_rcpname_classic"  PlaceholderText="Recipient name" MaxLength="18" HorizontalAlignment="Left" Text="{Binding Path=To, Mode=TwoWay}" Grid.Column="1" Style="{StaticResource contentstyle}" TextChanging="txt_rcpname_classic_TextChanging" />

private void txt_rcpname_classic_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            sender.Text = sender.Text.ToUpper();
            sender.SelectionStart = sender.Text.Length;
      }

2 Ответов

Рейтинг:
0
Рейтинг:
0

Ritesh3103

private void TextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
{
    TextBox TBx = (TextBox)sender;
           
    int Pose = TBx.SelectionStart;
    TBx.Text = TBx.Text.ToUpper();
    TBx.SelectionStart = Pose;
}