Why windows Phone 8.1 -Editor Rendered WITH MULTI LINE DON'T WANT TO ACCEPT CrLf?

DoBorisFDoBorisF USMember

Hello,
The field does not accept the CrLf characters(mean that at the first time they exist within the string entered then the text change method is called again second time, and within the debbug, I found that the text as being "cleaned" the CrLf does not appear within any more),
, while typing in it the word wrapping occurs and moves the cursor to the next line, not being able to make a new line at any place at the text.

I have a code example that subscribes a Control_Text Changed method to the Text Change event of the field.
here to show the problem I set the value of the text to a string that holds the \r\n mean CrLf characters within the string, this will cause and endless calling loop
while the text change event is recalled to clear the CrLf characters from the text set . Witch I do not understand why this is happened I did not request to filter/ignore the CrLf characters.
Here the code:
public class CustomEditorRenderer : EditorRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);

        if (Control == null || e.NewElement == null) return;
        Control.PlaceholderText = ((MyEditor) e.NewElement).Placeholder;
        Control.AcceptsReturn = true;
        Control.TextWrapping = TextWrapping.Wrap;
        Control.MinHeight = 150;
        Control.MaxHeight = 150;
        Control.TextChanged += Control_TextChanged;
    }
// The subcribed method to demostrade the endless calling loop trying to remove the \r\n chaeacters....
  private void Control_TextChanged(object sender, Windows.UI.Xaml.Controls.TextChangedEventArgs e)
    {
        ((TextBox)sender).Text = "Here is the end of the line.\r\nHere start a New line.";
     } 

}

Note:
The binding declaration at the ViewCell:
This binding works as expected ...
_editor.SetBinding(Editor.TextProperty, ffts => ffts.Value, BindingMode.OneWayToSource);

But the needed binding is the TWO_WAY because the field cut have initial values we are interested to show.

Answers

  • AdamPAdamP AUUniversity ✭✭✭✭✭

    @Bor - what value is it replacing it with. Is it stripping out those values to add in a environment specific newline character?

    Does it show correctly on screen and does it show the newline when you get the string at a later time?

  • DoBorisFDoBorisF USMember

    There are not new lines the text apear in one long line and when reaches the width it wraps to the next line.
    The expectation it is when using two way binding is it that when pressing the Enter button the new text line appears to continue thw witing....
    Like here.....
    and here.....
    :-)
    Thanks

Sign In or Register to comment.