'Is there a way to display choices through prompt options as still buttons even though few choices have larger length text in MSBOT via C# SDKV4?
I am creating a chatBot using microsoft Bot framework using SDKV4 in C#. The BOT has multiple waterfall dialogs. The channel is Web Chat Channel.
In this one dialog class shows few choice options in form of buttons using Prompt Options. Normally, if the choice list is simple like Option1 ,Option2 so on till Option6 the buttons will be displayed properly. But If i have choices which have text of greater length like the values provided in the below code:
return await stepContext.PromptAsync(
"choicePrompt",
new PromptOptions
{
Prompt = stepContext.Context.Activity.CreateReply("Based on the access privileges assigned to you by your admin, below are the options you can avail. Please click/choose any one from the following: "),
Choices = new[] { new Choice { Value = "Show My VMs" }, new Choice { Value = "Show VMs Status" }, new Choice { Value = "Start VM" }, new Choice { Value = "Stop VM" }, new Choice { Value = "Request Model/License" }, new Choice { Value = "Request For New VM" }, new Choice { Value = "Extend My Existing VM" }, new Choice { Value = "Logout" }, new Choice { Value = "Help" } }.ToList(),
RetryPrompt = stepContext.Context.Activity.CreateReply("Sorry, I did not understand that. Please choose any one from the options displayed below: "),
});
On executing the code the values provided in the choice list will not be rendered as buttons but instead as list of numbered bullet-ed text options something like below:
- Show My VMs
- Show VMs Status
- Start VM
- Stop VM
- Request Model/License
- Request For New VM
- Extend My Existing VM
- Logout
- Help
Now, if i remove the spaces between the words i.e if i modify/rewrite one of the option as only "RequestModel/License" (without spaces) like wise if is remove the space for all the text which have more than 2-3 words, on executing the code now the choices will be displayed as Buttons as expected.
So, coming to my query/issue: How can i still use choices in prompt options as shown in above code(with longer string values) and still make the buttons to be displayed?
Please note that i am a bit new to coding hence i would humbly request to provide detailed steps if this is behavior is achievable.
Thanks in Advance
Regards
ChaitanyaNG
Solution 1:[1]
It seems that you want to set the Style parameter in your call to PromptOptions to ListStyle.SuggestedAction.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | honey_badger |
