Microsoft.Common.OptionsGroup UI 元素

OptionsGroup 控件使用户可以从两个或更多个选项中选择一个选项。 用户只能选择一个选项。

注意

过去,此控件以水平方向呈现选项。 现在,控件将选项垂直显示为单选按钮。

UI 示例

Screenshot of Microsoft.Common.OptionsGroup UI element with vertically aligned radio buttons.

架构

{
  "name": "element1",
  "type": "Microsoft.Common.OptionsGroup",
  "label": "Some options group",
  "defaultValue": "Value two",
  "toolTip": "",
  "constraints": {
    "allowedValues": [
      {
        "label": "Value one",
        "value": "one"
      },
      {
        "label": "Value two",
        "value": "two"
      }
    ],
    "required": true
  },
  "visible": true
}

示例输出

"two"

备注

  • constraints.allowedValues 的标签是项的显示文本,并且当选中时,其值是元素的输出值。
  • 如果已指定,则默认值必须是 constraints.allowedValues 中存在的一个标签。 如果未指定,则默认情况下将选择 constraints.allowedValues 中的第一个项。 默认值为 null
  • constraints.allowedValues 必须至少有一项。

后续步骤