c# - Allow users to multiselect option in BotFramework
问题描述
I would like my Bot make surveys. The problem is that in some questions, the user could select more than 1 answer.
How could I implement this scenario? Is there an official sample on how to do it with version 3 of the SDK?
Thank you!
解决方案
问题是在某些问题中,用户可以选择超过 1 个答案。
要使用户能够选择超过 1 个问题的答案,您可以使用AdaptiveChoiceSetInput
来实现要求。以下代码片段供您参考。
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
});
测试结果:
推荐阅读
- rust - 如何修复 Rust 中移动值的使用?
- r - 如何计算 R 中有向图的聚类系数?
- google-cloud-transcoder - 谷歌云中有关 GA 仅音频转码的详细功能
- html - 如何在 Shiny App 中使用 URL 呈现 HTML 文件而不破坏其他交互式绘图和表格?
- websphere - 我想在结束对话的特定意图之前捕获声明的意图
- itfoxtec-identity-saml2 - 在 ITFoxtec.Identity 示例中,IdP 发起的如何使用 MVC?
- python - 以特定顺序递归生成子集解决方案
- java - 使用 JOption Pane 时,在 Canceled JOption Pane 期间,发生 NullPointerException
- mysql - PHPmyAdmin #1932 - 引擎中不存在
- google-cloud-transcoder - 谷歌云中的转码作业失败