有没有办法使建议的动作成为Botframework v4上的编号列表? [英] Is there a way to make suggested action a numbered list on Botframework v4?
本文介绍了有没有办法使建议的动作成为Botframework v4上的编号列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有显示按钮的建议操作.有没有办法使它像编号列表一样?然后用户只需要输入数字?
I have this suggested action that displays button. Is there a way to make it like a numbered list? And then the user will just need to type in the number?
return await stepContext.PromptAsync(TextPromptId, new PromptOptions
{
Prompt = new Activity
{
Type = ActivityTypes.Message,
Text = $"Choose a question or type your own question.",
SuggestedActions = new SuggestedActions()
{
Actions = new List<CardAction>()
{
new CardAction() { Title = "This is Sample Question 1", Type = ActionTypes.ImBack, Value = "This is Sample Question 1" },
new CardAction() { Title = "This is Sample Question 2", Type = ActionTypes.ImBack, Value = "This is Sample Question 2" },
new CardAction() { Title = "This is Sample Question 3", Type = ActionTypes.ImBack, Value = "This is Sample Question 3" },
},
},
});
推荐答案
我建议使用选择提示,并将promptOptions
中的ListStyle
设置为ListStyle.List
.
I would recommend using a Choice Prompt and setting the ListStyle
in promptOptions
to ListStyle.List
.
屏幕截图
代码段-C#SDK v4.5.0
private static async Task<DialogTurnResult> TransportStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
// WaterfallStep always finishes with the end of the Waterfall or with another dialog; here it is a Prompt Dialog.
// Running a prompt here means the next WaterfallStep will be run when the users response is received.
return await stepContext.PromptAsync(nameof(ChoicePrompt),
new PromptOptions
{
Prompt = MessageFactory.Text("Please enter your mode of transport."),
Choices = ChoiceFactory.ToChoices(new List<string> { "Car", "Bus", "Bicycle" }),
Style = ListStyle.List
}, cancellationToken);
}
希望这会有所帮助!
这篇关于有没有办法使建议的动作成为Botframework v4上的编号列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文