首页 > 解决方案 > 如何在 CardAction 中的标题中获取粗体文本

问题描述

CardAction()是否可以在 bot framework v4的标题中获得粗体文本?我在 HeroCard 中使用它。我试过 ** Option One ** 但它只适用于HeroCard例如 a 的文本,但不适用于CardAction()按钮。

这是我CardActions在 a 中的实现HeroCard

var Options = new HeroCard
        {
            Text = "What do you choose?",
            Buttons = new List<CardAction>
        {
                new CardAction() { Title = "Option One, Type = ActionTypes.ImBack, Value = ""Option One" },
                new CardAction() { Title = "Go back", Type = ActionTypes.ImBack, Value = "Go back" },
        },
        };

标签: .net-corebotframework

解决方案


你不能。由每个频道决定如何显示卡片。

或者,您可以尝试使用带有以下 JSON的自适应卡:

在此处输入图像描述

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "text": "What do you choose?"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "Container",
                    "items": [
                        {
                            "type": "TextBlock",
                            "text": "Option One",
                            "weight": "Bolder",
                            "horizontalAlignment": "Center",
                            "size": "Large",
                            "color": "Accent"
                        }
                    ],
                    "selectAction": {
                        "type": "Action.Submit"
                    },
                    "id": "optionOne",
                    "style": "default"
                },
                {
                    "type": "Container",
                    "items": [
                        {
                            "type": "TextBlock",
                            "text": "Go back",
                            "horizontalAlignment": "Center",
                            "size": "Large",
                            "weight": "Bolder",
                            "color": "Accent"
                        }
                    ],
                    "selectAction": {
                        "type": "Action.Submit",
                        "data": "goBack"
                    },
                    "id": "goBack",
                    "style": "default"
                }
            ],
            "style": "emphasis"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.0"
}

不过,这将取决于频道如何显示"weight": "Bolder"


推荐阅读