Microsoft.Common.CheckBox UI 元素Microsoft.Common.CheckBox UI element
CheckBox 控件允许用户检查或不检查某选项。The CheckBox control lets users check or uncheck an option. 检查了控件后,控件返回“true”,未检查时返回“false” 。The control returns true when the control is checked or false when not checked.
UI 示例UI sample
架构Schema
{
"name": "legalAccept",
"type": "Microsoft.Common.CheckBox",
"label": "I agree to the terms and conditions.",
"constraints": {
"required": true,
"validationMessage": "Please acknowledge the legal conditions."
}
}
示例输出Sample output
true
备注Remarks
将“必需”设置为“true”时,用户必须选中该复选框 。When you set required to true, the user must select the checkbox. 如果用户未选中该复选框,会显示验证消息。If the user doesn't select the checkbox, the validation message is displayed.
后续步骤Next steps
- 有关创建 UI 定义的简介,请参阅 CreateUiDefinition 入门。For an introduction to creating UI definitions, see Getting started with CreateUiDefinition.
- 有关 UI 元素中的公用属性的说明,请参阅 CreateUiDefinition 元素。For a description of common properties in UI elements, see CreateUiDefinition elements.