Windows phone 8 windowsphonetoolkit自定义消息框中的换行符

Windows phone 8 windowsphonetoolkit自定义消息框中的换行符,windows-phone-8,messagebox,windows-phone-toolkit,Windows Phone 8,Messagebox,Windows Phone Toolkit,使用windowsphonetoolkit,如何强制消息文本中的换行符使其格式正确。标准\n和\n \r换行符似乎不起作用 比如: This is the first line and This is another line. 您可以通过在内容属性而不是消息中设置消息来实现这一点。然后,消息可能只是一个文本块,您可以在其中执行任何您想要的操作 如果您在XAML中创建自定义消息框,则可能如下所示: 一线二线 但您也可以在代码隐藏中实现: CustomMessageBox messageB

使用windowsphonetoolkit,如何强制消息文本中的换行符使其格式正确。标准\n和\n \r换行符似乎不起作用

比如:

This is the first line
and 
This is another line.

您可以通过在内容属性而不是消息中设置消息来实现这一点。然后,消息可能只是一个文本块,您可以在其中执行任何您想要的操作

如果您在XAML中创建自定义消息框,则可能如下所示:

一线二线 但您也可以在代码隐藏中实现:

CustomMessageBox messageBox=新建CustomMessageBox { 标题=标题, LeftButtonContent=ok, RightButtonContent=取消, 内容=新文本块 { 边距=新厚度12, FontSize=doubleResources[PhoneFontSizeMedium], FontFamily=new System.Windows.Media.FontFamilySegee WP SemiLight, Text=第一行+环境。换行符+第二行, }, }; //messageBox.Show; 结果:

我最终使用了Environment.Newline。承蒙