Microsoft.Common.OptionsGroup UI 元素Microsoft.Common.OptionsGroup UI element

OptionsGroup 控件使用户可以从两个或更多个选项中选择一个选项。The OptionsGroup control lets users select one option from two or more choices. 用户只能选择一个选项。A user can select only one option.


过去,此控件以水平方向呈现选项。In the past, this control rendered the options horizontally. 现在,控件将选项垂直显示为单选按钮。Now, the control presents the options vertically as radio buttons.

UI 示例UI sample



  "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

示例输出Sample output



  • constraints.allowedValues 的标签是项的显示文本,并且当选中时,其值是元素的输出值。The label for constraints.allowedValues is the display text for an item, and its value is the output value of the element when selected.
  • 如果已指定,则默认值必须是 constraints.allowedValues 中存在的一个标签。If specified, the default value must be a label present in constraints.allowedValues. 如果未指定,则默认情况下将选择 constraints.allowedValues 中的第一个项。If not specified, the first item in constraints.allowedValues is selected by default. 默认值为 nullThe default value is null.
  • constraints.allowedValues 必须至少有一项。constraints.allowedValues must have at least one item.

后续步骤Next steps