gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 23:37:28 25 4
gpt4 key购买 nike

我有很长的字符串并在 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
};

但它只显示在 1 行上并且没有换行。我如何在不为 ContentDialogResult 自定义 xaml 的情况下包装它

感谢大家的支持!

最佳答案

ContentDialog接受任何对象作为标题和内容属性。所以,创建 TextBlock , 添加 TextWrapping属性并将其传递给 Content 而不是字符串对象。它会起作用。

        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
};

关于c# - 关于在 winphone 8.1 RT 中在 ContentDialogResult 中换行文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30137459/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com