Search code examples
botframework

Bot Framework Rendering Choices Changes Format


I've just tested a dialog with a list of choices that seem to render differently and I can't find any information on why this would be happening.

Given this list of choices:

Choices = ChoiceFactory.ToChoices(new List<string> 
{
    "No", 
    "Yes - xxxxxxxxxxxxxxxxx", 
    "Yes - xxxxxxxxxxxxxxxxx", 
    "Yes - xxxxxxxxxxxxxxxxx", 
    "Yes - xxxxxxxxxxxxxxxxx" 
})

It renders like this:

enter image description here

Whereas this list:

Choices = ChoiceFactory.ToChoices(new List<string> 
{ 
    "No", 
    "Yes 2", 
    "Yes - 3", 
    "Yes - 4", 
    "Yes - 5"
})

It renders how I want it too:

enter image description here

I've got other instances where I have a long list of buttons that scroll so I'm very confused why the first list above rendered like a list.

How can I force it to render like the second example?


Solution

  • This behavior has to do with the size of each choice and the amount of choices. When the choices themselves are small (ex: "Yes 2"), then they are able to show as the button type (how you want it to look). When they are displayed in this fashion, and there are many choices; then it will scroll off the screen (as you have seen).

    When the choices (any one choice) becomes longer (ex: "Yes - xxxxxxxxxxxxxxxxx") then they get put into the list format. I don't believe there is a way to override this, but I will take a look. If not; the only option is to try and keep your choices small in size.

    Additionally; each channel handles rendering/displaying in it's own fashion. For example; if i create many (~20) choices of the small variety; then they will show as the scroll-able "buttons" in web chat, where in Skype they will show as a list.