关于在 winphone 8.1 RT 中在 ContentDialogResult 中换行文本
about wrap text in ContentDialogResult in winphone 8.1 RT
我有很长的字符串并在 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 accepts any object as Title and Content property. So, create TextBlock, add 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
};
我有很长的字符串并在 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 accepts any object as Title and Content property. So, create TextBlock, add 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
};