如何更改默认按钮标签“无首选项"?在FormFlow中 [英] How to change the default button label "No Preference" in FormFlow

查看:118
本文介绍了如何更改默认按钮标签“无首选项"?在FormFlow中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在更新用户输入以读取例如我不想改变任何事情."没有引入新的Resources.*.resx文件?

Is there a way to modify the default "No Preference" label of the button when updating the user inputs to read e.g. "I don't want to change anything." without introducing a new Resources.*.resx file?

我尝试了所有允许更改此类文字的模板,但我发现没有人可以实现此目的. TemplateUsage.NoPreference只能用于更改可选字段的值,而不能用于更改按钮标签.

I tried all templates that allow changing such literals but I found no one that could achieve this. TemplateUsage.NoPreference can be used to change only the value of an optional field, not the button label.

推荐答案

您可以通过覆盖FormFlow中的Template值来做到这一点.

You can do it by overriding the Template value in your FormFlow.

以下是基于Microsoft.Bot.Sample.SimpleSandwichBot的示例:

Here is an example based on the Microsoft.Bot.Sample.SimpleSandwichBot:

public static IForm<SandwichOrder> BuildForm()
{
    var formBuilder = new FormBuilder<SandwichOrder>()
            .Message("Welcome to the simple sandwich order bot!");

    var noPreferenceStrings = new string[] { "Nothing" };

    // Set the new "no Preference" value
    formBuilder.Configuration.Templates.Single(t => t.Usage == TemplateUsage.NoPreference).Patterns = noPreferenceStrings;

    // Change this one to help detection of what you typed/selected
    formBuilder.Configuration.NoPreference = noPreferenceStrings;

    return formBuilder.Build();
}

演示捕获:

这篇关于如何更改默认按钮标签“无首选项"?在FormFlow中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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