【问题标题】:How to get bold text in the title in CardAction如何在 CardAction 中的标题中获取粗体文本
【发布时间】:2019-07-23 01:39:44
【问题描述】:

在 bot framework v4 中是否可以在 CardAction() 的标题中获取粗体文本?我在 HeroCard 中使用它。我试过 ** 选项一 ** 但它仅适用于 HeroCard 的文本,但不适用于 CardAction() 按钮。

这是我在HeroCard 中对CardActions 的实现:

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-core botframework


    【解决方案1】:

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

    或者,您可以尝试将Adaptive Card 与以下 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"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-02
      • 1970-01-01
      • 2021-09-13
      • 2018-09-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多