C# 关于在ContentDialogResult中换行文本winphone 8.1 RT
我有一个长字符串,在ContentDialogResult中显示为C# 关于在ContentDialogResult中换行文本winphone 8.1 RT,c#,xaml,windows-runtime,windows-phone-8.1,C#,Xaml,Windows Runtime,Windows Phone 8.1,我有一个长字符串,在ContentDialogResult中显示为 var dlg = new ContentDialog() { Title = sTitle, Content = "This is very long string and i want wrap it but it only appear in 1 line on content of ContentDialogResult. Please help me!",
var dlg = new ContentDialog()
{
Title = sTitle,
Content = "This is very long string and i want wrap it but it only appear in 1 line on content of ContentDialogResult. Please help me!",
PrimaryButtonText = sTextBtnMain,
SecondaryButtonText = sTextBtnSub
};
但它只显示在一行上,没有包装。如何在没有ContentDialogResult自定义xaml的情况下将其包装
谢谢大家的支持 接受任何对象作为标题和内容属性。所以,创建、添加属性并将其传递给内容,而不是字符串对象。它会起作用的
TextBlock txtBlock = new TextBlock();
txtBlock.Text = "This is very long string and i want wrap it but it only appear in 1 line on content of ContentDialogResult. Please help me!";
txtBlock.TextWrapping = TextWrapping.Wrap;
ContentDialog dialog = new ContentDialog()
{
Title = sTitle,
Content = txtBlock,
PrimaryButtonText = sTextBtnMain,
SecondaryButtonText = sTextBtnSub
};
只需查看ContentDialog的MSDN库中的示例代码。注意TextBlock的用法。@HansPassant你能准确地告诉我吗,我发现它显示的是自定义的xaml