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 – 控制項允許使用者輸入 (編輯)、只顯示資料 (檢視) 或者已停用 (停用)。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 – 控制項的文字字型粗細︰BoldSemiboldNormalLighterFontWeight – 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 屬性以顯示 Reserve nowAdd 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.