PowerApps 中的標籤控制項Label control in PowerApps

顯示文字、數字、日期或貨幣這類資料的方塊。A box that shows data such as text, numbers, dates, or currency.

說明Description

標籤會顯示您指定為常值文字字串 (會以您輸入的確切文字字串顯示) 的資料,或顯示指定為評估為文字字串的公式的資料。A label shows data that you specify as a literal string of text, which appears exactly the way you type it, or as a formula that evaluates to a string of text. 標籤通常會顯示在任何其他控制項 (例如可識別螢幕的橫幅) 外部、顯示為可識別另一個控制項 (例如評等或音訊控制項) 的標籤,或顯示在資源庫中,以顯示項目的特定類型資訊。Labels often appear outside of any other control (such as a banner that identifies a screen), as a label that identifies another control (such as a rating or audio control), or in a gallery to show a specific type of information about an item.

主要屬性Key properties

AutoHeight – 設定為 true,允許標籤自動增加其高度以顯示所有設定的文字。AutoHeight – Set to true to allow the label to auto-grow its height to show all text configurated. 設定為 false 可將文字截斷成所指派的高度。Set to false to truncate the text to the height assigned.

Color – 控制項文字的色彩。Color – The color of text in a control.

Font – 文字可使用的字型家族名稱。Font – The name of the family of fonts in which text appears.

Text – 控制項上顯示的文字,或使用者在控制項中輸入的文字。Text – Text that appears on a control or that the user types into a control.

DelayOutput – 設定為 true 可延遲文字輸入期間的動作。DelayOutput – Set to true to delay action during text input.

其他屬性Additional properties

Align – 文字相對於其控制項水平中心的位置。Align – The location of text in relation to the horizontal center of its control.

AutoHeight – 標籤是否會自動增加其 Height 屬性 (如果其 Text 屬性所含的字元數超過控制項一次可以顯示的字元數)。AutoHeight – Whether a label automatically increases its Height property if its Text property contains more characters than the control can show at one time.

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.

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.

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.

LineHeight – 兩者之間的距離,例如文字行或清單中項目之間的距離。LineHeight – The distance between, for example, lines of text or items in a list.

OnSelect – 在使用者點選或按一下控制項時,應用程式的回應方式。OnSelect – How the app responds when the user taps or clicks a control.

Overflow – 捲軸是否出現在標籤中 (如果其 Wrap 屬性設定為 true,而且控制項的 Text 屬性值所含的字元數超過控制項一次可以顯示的字元數)。Overflow – Whether a scrollbar appears in a label if its Wrap property is set to true and the value of the control's Text property contains more characters than the control can show at one time.

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.

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.

Wrap – 太長而無法放入標籤中的文字是否換行至下一行。Wrap – Whether text that's too long to fit in a label wraps to the next line.

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).

Text( Number, "FormatCodes" )Text( Number, "FormatCodes" )

範例Examples

顯示常值字串Show a literal string

顯示公式的結果Show the result of a formula

  • 新增標籤,並將其 Text 屬性設定為下列公式:Add a label, and set its Text property to a formula such as this one:
    Today() Today()

    注意︰指定公式時,除非公式的引數是常值字串,否則請不要使用引號。Note: When you specify a formula, you don't use quotation marks unless an argument of the formula is a literal string. 在此情況下,請使用雙引數括住引數,而非公式。In that case, enclose the argument, not the formula, in double quotation marks.

    想要了解 Today 函式或其他函式的詳細資訊嗎?Want more information about the Today function or other functions?

在此程序中,您將建立稱為 CityPopulations 的集合,而此集合包含歐洲不同城市的人口資料。In this procedure, you'll create a collection, called CityPopulations, that contains data about the population of various cities in Europe. 接下來,您將會顯示資源庫中包含三個標籤的資料,並指定每個標籤將顯示的資料類型。Next, you'll show that data in a gallery that contains three labels, and you'll specify the type of data that each label will show.

  1. 新增一個按鈕,並將其 OnSelect 屬性設為以下公式:Add a button, and set its OnSelect property to this formula:
    ClearCollect(CityPopulations, {City:"London", Country:"United Kingdom", Population:8615000}, {City:"Berlin", Country:"Germany", Population:3562000}, {City:"Madrid", Country:"Spain", Population:3165000}, {City:"Rome", Country:"Italy", Population:2874000}, {City:"Paris", Country:"France", Population:2273000}, {City:"Hamburg", Country:"Germany", Population:1760000}, {City:"Barcelona", Country:"Spain", Population:1602000}, {City:"Munich", Country:"Germany", Population:1494000}, {City:"Milan", Country:"Italy", Population:1344000}) ClearCollect(CityPopulations, {City:"London", Country:"United Kingdom", Population:8615000}, {City:"Berlin", Country:"Germany", Population:3562000}, {City:"Madrid", Country:"Spain", Population:3165000}, {City:"Rome", Country:"Italy", Population:2874000}, {City:"Paris", Country:"France", Population:2273000}, {City:"Hamburg", Country:"Germany", Population:1760000}, {City:"Barcelona", Country:"Spain", Population:1602000}, {City:"Munich", Country:"Germany", Population:1494000}, {City:"Milan", Country:"Italy", Population:1344000})
  2. 按下 F5 鍵,並選取該按鈕,然後按下 Esc 鍵。Press F5, select the button, and then press Esc.
  3. 新增文字庫,並將其 Items 屬性設定為 CityPopulationsAdd a text gallery, and set its Items property to CityPopulations.

    選取資源庫時,右窗格會顯示該資源庫的選項。When the gallery is selected, the right pane shows options for that gallery.

  4. Gallery1 窗格中,將最上層清單設定為 Population、將中間清單設定為 City,並將最底端清單設定為 CountryIn the Gallery1 pane, set the top list to Population, set the middle list to City, and set the bottom list to Country.