PowerApps 中的评分控件Rating control in PowerApps

用户可以用于指示介于 1 和你指定的最大数之间的值的控件。A control with which users can indicate a value between 1 and a maximum number that you specify.

说明Description

例如,用户可以在此控件中通过选择一定数量的星星来表示他们对某些内容所喜爱的程度。In this control, the user can indicate, for example, how much they liked something by selecting a certain number of stars.

关键属性Key properties

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

Max – 用户可对滑块或评分设置的最大值。Max – The maximum value to which the user can set a slider or a rating.

其他属性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.

FocusedBorderThickness – 控件具有键盘焦点时的边框粗细。FocusedBorderThickness – The thickness of the control's border when it has keyboard focus.

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

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

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

OnChange – 用户更改控件的值(例如,通过调整滑块)时应用的响应方式。OnChange – How the app responds when the user changes the value of a control (for example, by adjusting a slider).

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

RatingFill – 评分控件中星星的颜色。RatingFill – The color of the stars in a rating control.

ReadOnly – 用户是否可以更改滑块或评分控件的值。ReadOnly – Whether a user can change the value of a slider or rating control.

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

ShowValue – 用户更改滑块或评分的值或将鼠标悬停在控件上时,是否显示该值。ShowValue – Whether a slider's or rating's value appears as the user changes that value or hovers over the control.

TabIndex - 设置为非零值时,在运行时自定义控件的选项卡顺序。TabIndex – Customizes the tab order of controls at runtime when set to a non-zero value.

Tooltip - 用户将鼠标悬停在控件上时显示的解释性文本。Tooltip – Explanatory text that appears when the user hovers over a 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).

Average( Value1, Value2, ... )Average( Value1, Value2, ... )

示例Example

  1. 添加“评分”控件,并将其命名为“定量”。Add a Rating control, and name it Quantitative.

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

  2. 添加“文本输入”控件,将其命名为“定性”,并将其移至“评分”控件下。Add a Text input control, name it Qualitative, and move it below the Rating control.
  3. “文本输入”控件的“Default”属性设置为 "",并将其“HintText”设置为以下公式:Set the Default property of the Text input control to "", and set its HintText to this formula:
    If(Quantitative.Value > 3, "What did you especially like?", "How might we do better?")If(Quantitative.Value > 3, "What did you especially like?", "How might we do better?")

    想要了解有关 If 函数或其他函数的详细信息?Want more information about the If function or other functions?

  4. 按 F5,然后在“评分”控件中单击或点击四颗或五颗星。Press F5, and then click or tap either four or five stars in the Rating control.

    文本输入控件中的提示文本将发生变化以体现高评分。The hint text in the Text input control changes to reflect the high rating.

  5. 在“定量”中单击或点击少于四颗星。Click or tap fewer than four stars in Quantitative.

    Text input 控件中的提示文本将发生变化以体现低评分。The hint text in the Text input control changes to reflect the low rating.

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