Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UWP TextBox puts \r only - how to set LineBreak

Tags:

c#

textbox

xaml

uwp

I fill a TextBox with multiple lines from clipboard, which contains \r\n as linebreak (so same as in Environment.NewLine. After I make a change and want to get the text, I get only \r as linebreaks back. Is there any way to change this?

like image 780
Matt Avatar asked Oct 26 '25 03:10

Matt


1 Answers

I find the UWPBox can help you.

UWPBox: https://github.com/ruffin--/UWPBox

As the author say:

Let me emphasize that first one. Even if Environment.NewLine is \r\n, and you have \r\n all over myTextBox.Text, if you check myTextBox.SelectedText, at least in Windows 10 for PCs, all newlines will be turned into \r!!! This makes for really wacky integrations of changes to SelectedText back into the context of Text. See the StackOverflow question for a specific example.

like image 60
lindexi Avatar answered Oct 27 '25 18:10

lindexi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!