[UWP] TextBox Newline changes between SDK 10240 and 14393 RRS feed

  • General discussion

  • With the following XAML

    <TextBox AcceptsReturn="True" Height="200" x:Name="tb"/>
    <Button Content="Do it" Click="Button_Click" />

    And the following code

    private void Button_Click(object sender, RoutedEventArgs e)

    When I press enter in the text box and then hit the button while targeting 10240 I get a true.  If you inspect the string, it contains \r\n as the newline.

    When targeting 14393 it returns false as the string only contains \r.

    What gives? Why did this change and why does it not respect Environment.NewLine?

    • Edited by Willie Z Friday, September 2, 2016 4:43 AM Tagging title
    Friday, September 2, 2016 4:40 AM

All replies

  • Does this at least happen for anyone else?  I've tried it on two separate installations and was able to replicate it.

    Is there a better place to report UWP bugs than here?

    Thursday, September 8, 2016 3:42 AM
  • The same issue happened for my app.

    I were using the following line of code to break the strings:

    string[] items = checklistString.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

    It doesn't work because the newline returned by the TextBox will use '\r' as its newline breaker while Environment.NewLine is "\r\n".

    Sunday, December 11, 2016 3:02 AM
  • Did you find a solution for this issue (apart from the obvious string replacement magic)?
    Wednesday, April 4, 2018 9:30 PM
  • Did you find a solution for this issue (apart from the obvious string replacement magic)?
    Nope. Had to do replaces. It's really baffling that this is the behavior.
    Wednesday, April 4, 2018 10:12 PM