Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 关于在ContentDialogResult中换行文本winphone 8.1 RT_C#_Xaml_Windows Runtime_Windows Phone 8.1 - Fatal编程技术网

C# 关于在ContentDialogResult中换行文本winphone 8.1 RT

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!",

我有一个长字符串,在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!",
            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