question

gokulram-7970 avatar image
0 Votes"
gokulram-7970 asked AryaDing-MSFT edited

Text trimming in TextBox uwp

I need a text trimming behaviour in textbox of UWP when textbox is at normal state.

windows-uwp
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@gokulram-7970 For uwp app, the TextBlock control contains a TextTrimming property, however, the TextBox doesn’t support this property directly. Do you want to have the similar behavior like the TextBlock? You means the TextBox have the Text trimming effect when it lost the focus and the text width exceeds the TextBox width, right? Why don’t you think about the TextWrapping property of TextBox, which is easier to reach. I suggest you could implement the wrapping effect instead the TextTrimming effect .

0 Votes 0 ·

@AryaDing-MSFT hi, TextWrapping property will increase textbox height.

0 Votes 0 ·

@gokulram-7970 Could you please tell me Why you are doing this? If you just want to limit the input length, you could use String.SubString method to trim the Text in TextBox_TextChanged event when the input text length is up to limitation.

0 Votes 0 ·

0 Answers