PowerApps 中的下拉式方塊控制項Combo box control in PowerApps

允許使用者從其提供的選項中選取項目的控制項。A control that allows users to make selections from provided choices. 支援搜尋和多重選取。Supports search and multiple selections.

說明Description

[下拉式方塊] 控制項可讓您搜尋您將選取的項目。A Combo box control allows you to search for items you will select. 該搜尋是在伺服器端上的 SearchField 屬性執行,因此效能不會受到非常大型的資料來源影響。The search is performed server-side on the SearchField property so performance is not affected by very large data sources.

單一或多重選取模式是透過 SelectMultiple 屬性設定。Single or multi-select mode is configured via the SelectMultiple property.

搜尋要選取的項目時,您可以就個別項目在 [資料] 窗格中修改 [版面配置] 設定,以選擇要顯示單一資料值、兩個值,還是或一張圖片和兩個值 (人員)。When searching for items to select, for each item you can choose to show a single data value, two values, or a picture and two values (Person) by modifying the Layout settings in the Data pane.

人員選擇器People picker

若要使用下拉式方塊作為人員選擇器,請從 [資料] 窗格中的 [版面配置] 設定選擇 [人員] 範本,並設定要為下方的人員顯示的相關資料屬性。To use Combo box as a people picker, choose the Person template from the Layout settings in the Data pane and configure the related data properties to be shown for the person below.

主要屬性Key properties

Items – 可從中建立選取的資料來源。Items – The source of data from which selections can be made.

DefaultItems – 在使用者與控制項互動之前的初始選定項目。DefaultItems – The initial selected item(s) before the user interacts with the control.

SelectedItems – 因使用者互動而選取的項目清單。SelectedItems – List of selected items resulting from user interaction.

SelectMultiple – 使用者是只可以選取單一項目或可以選取多個項目。SelectMultiple – Whether the user can select a single item or multiple items.

IsSearchable – 使用者是否可以先搜尋項目,然後再選取。IsSearchable – Whether the user can search for items before selecting.

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

Default – 在單一選取模式下,使用者變更之前的初始選擇。Default – The initial selection before it is changed by the user in single-select mode.

DisplayFields – 針對搜尋所傳回的每個項目,所顯示的欄位清單。DisplayFields – List of fields shown for each item returned by the search. 透過 [屬性選項] 索引標籤中的 [資料] 窗格,最容易進行設定。Easiest to configure via the Data pane in the Properties option tab.

DisplayMode – 控制項允許使用者輸入 (編輯)、只顯示資料 (檢視) 或者已停用 (停用)。DisplayMode – Whether the control allows user input (Edit), only displays data (View), or is disabled (Disabled).

Height – 控制項的頂端和底部邊緣之間的距離。Height – The distance between a control's top and bottom edges.

InputTextPlaceholder – 未選取任何項目時,向使用者顯示的說明文字。InputTextPlaceholder – Instructional text shown to end-users when no items are selected.

OnChange – 使用者變更選項時,應用程式會如何回應。OnChange – How the app responds when the user changes a selection.

OnNavigate – 使用者在項目上按一下時,應用程式會如何回應。OnNavigate – How the app responds when the user clicks on an item.

OnSelect – 在使用者點選或按一下控制項時,應用程式的回應方式。OnSelect – How the app responds when the user taps or clicks 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).

範例Example

  1. 從 [插入] 索引標籤的 [控制項] 功能表,新增 [下拉式方塊] 控制項。Add a Combo box control from the Insert tab, Controls menu.
  2. 在 [屬性選項] 索引標籤中,按一下 [資料]。In the Properties options tab, click on Data.
  3. 選取下方的資料來源、版面配置與相關屬性。Select the data source, layout and related properties below.
  4. 在 [進階] 索引標籤中設定 SelectMultiple 屬性。Set the SelectMultiple property in the Advanced tab.

    您的應用程式中會出現功能性 [下拉式方塊]。A functional Combo box will appear in your app.

    不知道如何新增和設定控制項嗎?Don't know how to add and configure a control?.