我正在显示一张有几个按钮的英雄卡片。我想在每个按钮的文本之间添加换行符。我使用的频道是MSTeams
我在文本之间添加了HTML元素,但这似乎没有帮助
List<CardAction> cardButtons = new List<CardAction>();
foreach (var item in items)
{
string CurrentNumber = Convert.ToString(item.number);
CardAction CardButton = new CardAction()
{
Type = "imBack",
Title = ""+CurrentNumber + "\n" + "Short Description: "+ item.short_description + "<ul><li>" + "Opened on: "+item.opened_at + "</li><li>" + "Incident state: "+myDict[item.incident_state]+ "</li></ul>"+"", //I tried this
Text = ""+CurrentNumber + "\n" + "Short Description: "+ item.short_description + "<ul><li>" + "Opened on: "+item.opened_at + "</li><li>" + "Incident state: "+myDict[item.incident_state]+ "</li></ul>"+"", //And this one too
Value = CurrentNumber
};
cardButtons.Add(CardButton);
}
HeroCard plCard = new HeroCard()
{
//Images = cardImages,
Buttons = cardButtons,
};
// Create an Attachment by calling the
// ToAttachment() method of the Hero Card
Attachment plAttachment = plCard.ToAttachment();
// Attach the Attachment to the reply
reply.Attachments.Add(plAttachment);
// set the AttachmentLayout as 'list'
reply.AttachmentLayout = "list";
虽然它在模拟器中工作正常如果我添加“\ n”,在MS团队中,我没有得到相同的输出。在悬停时,看起来文本看起来很好,但没有MS团队。
@Sash Sheen Teams仅在Text属性中支持formatting in cards。按钮不支持它。
按钮意味着很小,并且不应该有很多文本。所有渠道都是如此。
我的建议是在按钮本身上添加一个简短的标签,并在其他地方提供任何其他所需信息,例如卡片的文字。在你的情况下,似乎只需要按钮上的数字就可以了。