允许用户在BotFramework中进行多选选项 [英] Allow users to multiselect option in BotFramework

查看:53
本文介绍了允许用户在BotFramework中进行多选选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的机器人进行调查.问题在于,在某些问题中,用户可以选择多个答案.

I would like my Bot make surveys. The problem is that in some questions, the user could select more than 1 answer.

如何实现这种情况?是否有关于使用版本3的SDK的官方示例?

How could I implement this scenario? Is there an official sample on how to do it with version 3 of the SDK?

谢谢!

推荐答案

问题在于,在某些问题中,用户可以选择多个答案.

The problem is that in some questions, the user could select more than 1 answer.

要使用户能够选择一个以上的问题答案,可以使用 AdaptiveChoiceSetInput 达到要求.以下代码段供您参考.

To enable user to select more than 1 answer to question(s), you can use AdaptiveChoiceSetInput to achieve the requirement. The following code snippet is for your reference.

card.Body.Add(new AdaptiveTextBlock()
{
    Text = "Q1:xxxxxxxx?",
    Size = AdaptiveTextSize.Default,
    Weight = AdaptiveTextWeight.Bolder
});

card.Body.Add(new AdaptiveChoiceSetInput()
{
    Id = "choiceset1",
    Choices = new List<AdaptiveChoice>()
    {
        new AdaptiveChoice(){
            Title="answer1",
            Value="answer1"
        },
        new AdaptiveChoice(){
            Title="answer2",
            Value="answer2"
        },
        new AdaptiveChoice(){
            Title="answer3",
            Value="answer3"
        }
    },
    Style = AdaptiveChoiceInputStyle.Expanded,
    IsMultiSelect = true
});

测试结果:

这篇关于允许用户在BotFramework中进行多选选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆