I've noticed that this...
void MyTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
ApplicationData.Current.RoamingSettings.Values["Text"] = Text;
}
...is unreliable in Windows 8.1 Store Apps when the Text of your TextBox contains a newline character (AKA it doesn't save when you have a newline \n
in the Text
object). What are the ways around this?
Using Regex.Escape(Text)
and Regex.Unescape((string)ApplicationData.Current.RoamingSettings.Values["Text"])
doesn't seem to work for me, either. The sandbox probably tries to circumvent any \
's to block shellcode injection into the OS layer.
The only thing that seems to work is to save to file in the RoamingSettings...
Look at the example code in here: ApplicationData.RoamingSettings | roamingSettings property
With regards to this:
Try by setting both the
TextBox.AcceptsReturn
property andTextBox.Multiline
property totrue
. See the sample in TextBox.AcceptsReturn link above.