PowerApps 中的复选框控件Check box control in PowerApps

用户可选择或清除以将其值设置为 truefalse 的控件。A control that the user can select or clear to set its value to true or false.

说明Description

用户可以使用此熟悉的控件指定布尔值,这个控件在 GUI 中已经使用了数十年。The user can specify a Boolean value by using this familiar control, which has been used in GUIs for decades.

关键属性Key properties

Default - 用户更改控件前的初始值。Default – The initial value of a control before it is changed by the user.

Text – 在控件上显示或用户键入到控件中的文本。Text – Text that appears on a control or that the user types into a control.

Value – 输入控件的值。Value – The value of an input control.

其他属性Additional properties

BorderColor – 控件边框的颜色。BorderColor – The color of a control's border.

BorderStyle – 控件边框是实线虚线点线还是BorderStyle – Whether a control's border is Solid, Dashed, Dotted, or None.

BorderThickness – 控件边框的粗细。BorderThickness – The thickness of a control's border.

CheckboxBackgroundFill - 复选框控件中围绕选中标记的框的背景颜色。CheckboxBackgroundFill – The background color of the box that surrounds the checkmark in a checkbox control.

CheckboxBorderColor - 复选框控件中围绕选中标记的边框颜色。CheckboxBorderColor – The color of the border that surrounds the checkmark in a checkbox control.

CheckboxSize - 复选框控件中围绕选中标记的框的宽度和高度。CheckboxSize – The width and height of the box that surrounds the checkmark in a checkbox control.

CheckmarkFill - 复选框控件中选中标记的颜色。CheckmarkFill – The color of the checkmark in a checkbox control.

Color – 控件中文本的颜色。Color – The color of text in a control.

DisplayMode – 此控件是允许用户输入 (Edit)、仅显示数据 (View),还是已禁用 (Disabled)。DisplayMode – Whether the control allows user input (Edit), only displays data (View), or is disabled (Disabled).

DisabledBorderColor – 控件的 DisplayMode 属性设置为 Disabled 时,该控件边框的颜色。DisabledBorderColor – The color of a control's border if the control's DisplayMode property is set to Disabled.

DisabledColor – 控件的 DisplayMode 属性设置为 Disabled 时,该控件中的文本颜色。DisabledColor – The color of text in a control if its DisplayMode property is set to Disabled.

DisabledFill – 控件的 DisplayMode 属性设置为 Disabled 时,该控件的背景颜色。DisabledFill – The background color of a control if its DisplayMode property is set to Disabled.

Fill – 控件的背景颜色。Fill – The background color of a control.

Font – 文本中所显示的字体系列的名称。Font – The name of the family of fonts in which text appears.

FontWeight – 控件中文本的粗细:粗体半粗体正常细体FontWeight – The weight of the text in a control: Bold, Semibold, Normal, or Lighter.

Height – 控件上边缘和下边缘之间的距离。Height – The distance between a control's top and bottom edges.

HoverBorderColor – 用户将鼠标指针停留在控件上时,该控件边框的颜色。HoverBorderColor – The color of a control's border when the user keeps the mouse pointer on that control.

HoverColor – 用户将鼠标指针停留在控件上时,该控件中的文本颜色。HoverColor – The color of the text in a control when the user keeps the mouse pointer on it.

HoverFill – 用户将鼠标指针停留在控件上时,该控件的背景颜色。HoverFill – The background color of a control when the user keeps the mouse pointer on it.

Italic – 控件中的文本是否为斜体。Italic – Whether the text in a control is italic.

OnCheck - 复选框或切换控件的值更改为 true 时应用的响应方式。OnCheck – How an app responds when the value of a checkbox or a toggle changes to true.

OnSelect – 用户点击或单击某个控件时应用响应的方式。OnSelect – How the app responds when the user taps or clicks a control.

OnUncheck - 复选框或切换控件的值更改为 false 时应用的响应方式。OnUncheck – How an app responds when the value of a checkbox or a toggle changes to false.

PaddingBottom – 控件中的文本与该控件下边缘之间的距离。PaddingBottom – The distance between text in a control and the bottom edge of that control.

PaddingLeft - 控件中的文本与该控件的左边缘之间的距离。PaddingLeft – The distance between text in a control and the left edge of that control.

PaddingRight - 控件中的文本与该控件的右边缘之间的距离。PaddingRight – The distance between text in a control and the right edge of that control.

PaddingTop - 控件中的文本与该控件的上边缘之间的距离。PaddingTop – The distance between text in a control and the top edge of that control.

PressedBorderColor – 用户在点击或单击控件时,该控件边框的颜色。PressedBorderColor – The color of a control's border when the user taps or clicks that control.

PressedColor – 用户在点击或单击控件时,该控件中的文本的颜色。PressedColor – The color of text in a control when the user taps or clicks that control.

PressedFill – 用户在点击或单击控件时,该控件的背景色。PressedFill – The background color of a control when the user taps or clicks that control.

Reset - 是否还原控件的默认值。Reset – Whether a control reverts to its default value.

Size – 控件上显示的文本的字号。Size – The font size of the text that appears on a control.

Strikethrough – 通过文本显示的线是否在控件上显示。Strikethrough – Whether a line appears through the text that appears on a control.

Tooltip - 用户将鼠标悬停在控件上时显示的解释性文本。Tooltip – Explanatory text that appears when the user hovers over a control.

Underline – 在文本下方显示的线是否在控件上显示。Underline – Whether a line appears under the text that appears on a control.

VerticalAlign – 控件上的文本相对于该控件垂直居中的位置。VerticalAlign – The location of text on a control in relation to the vertical center of that control.

Visible – 控件显示还是隐藏。Visible – Whether a control appears or is hidden.

Width – 控件左边缘和右边缘之间的距离。Width – The distance between a control's left and right edges.

X - 控件左边缘与其父容器(如果没有父容器,则为屏幕)左边缘之间的距离。X – The distance between the left edge of a control and the left edge of its parent container (screen if no parent container).

Y - 控件上边缘与其父容器(如果没有父容器,则为屏幕)上边缘之间的距离。Y – The distance between the top edge of a control and the top edge of the parent container (screen if no parent container).

If( Condition, Result )If( Condition, Result )

示例Example

  1. 添加复选框控件,将其命名为 chkReserve,然后设置其 Text 属性,使其显示为“暂时保留”。Add a Check box control, name it chkReserve, and set its Text property to show Reserve now.

    不知道如何添加、命名和配置控件Don't know how to add, name, and configure a control?

  2. 添加日期选取器控件,将其 Visible 属性设置为此公式:Add a Date picker control, and set its Visible property to this formula:
    If(chkReserve.Value = true, true)If(chkReserve.Value = true, true)

    想要详细了解 If 函数或其他函数吗?Want more information about the If function or other functions?

  3. 按 F5,单击或点击“chkReserve”,将其“Value”属性设置为 true,然后再次单击或点击“chkReserve”,将其“Value”属性设置为 falsePress F5, click or tap chkReserve to set its Value property to true, and then click or tap chkReserve again to set its Value property to false.

    如果 chkReserveValue 属性为 true,则将显示“日期选取器”控件,如果为 false,则不会显示。The Date Picker control appears when the Value property of chkReserve is true but not when it's false.

  4. 若要返回到默认工作区,请按 Esc 键。To return to the default workspace, press Esc.