Bot Framework V3,如何使用 c# 在自适应卡中获取相邻的提交操作按钮

Bot Framework V3, How to get Adjacent Submit Action buttons in an adaptive card with c#

我正在尝试获取相邻的提交操作Desired submit action,rather than the default action buttons(one below the other) that we get in an adaptive carddefault submit action buttons。请参考所附图片。

如果您能告诉我我们如何使用 C# 实现此目的,那将会很有帮助。提前感谢您的帮助。

遗憾的是,Botframework 中的按钮方向是特定于频道的。唯一可以在同一行上对齐按钮的通道是 WebChat 和 DirectLine,但是在这两个通道中更改按钮对齐方式的过程非常复杂。

解决您的问题的一种简单方法是创建两列并向每列添加一个 selectAction 属性。这样,当用户单击该列时,它将调用相应的操作。此方法适用于 OpenUrl 和提交操作,但不适用于 ShowCard 操作。这种方法唯一的另一个缺点是每列的格式与其他按钮的格式不同(无法在每列周围放置轮廓),但您可以向每列添加图像以获得所需的 UI.

希望这对您有所帮助。

{
"type": "ColumnSet",
"spacing": "Medium",
"columns": [
    {
        "type": "Column",
        "selectAction": {
            "type": "Action.OpenUrl",
            "url": "https://www.microsoft.com/"
        },
        "items": [
            {
                "type": "TextBlock",
                "horizontalAlignment": "Center",
                "size": "Large",
                "weight": "Bolder",
                "color": "Accent",
                "text": "Set due date"
            }
        ],
        "width": 1
    },
    {
        "type": "Column",
        "selectAction": {
            "type": "Action.OpenUrl",
            "url": "https://www.microsoft.com/"
        },
        "items": [
            {
                "type": "TextBlock",
                "horizontalAlignment": "Center",
                "size": "Large",
                "weight": "Bolder",
                "color": "Accent",
                "text": "Comment"
            }
        ],
        "width": 1
    }