PowerApps 中的库控件Gallery control in PowerApps

包含其他控件并显示一组数据的控件。A control that contains other controls and shows a set of data.

说明Description

“库”控件可以显示数据源中的多条记录,每条记录都能包含多种类型的数据。A Gallery control can show multiple records from a data source, and each record can contain multiple types of data. 例如,“库”控件可以显示多个联系人,其中每一项都用于显示联系人信息,包括每个联系人的姓名、地址和电话号码。For example, a Gallery control can show multiple contacts with each item showing contact information that includes a name, an address, and a phone number for each contact. 每个数据字段显示在“库”控件的单独控件内,可以在库模板中配置这些控件。Each data field appears in a separate control within the Gallery control, and you can configure those controls in its template. 此模板显示为库中的第一项,如果库为水平/横向,此模板显示在“库”控件的左边缘;如果库为垂直/纵向,此模板显示在“库”控件的上边缘。The template appears as the first item inside the gallery, on the left edge of a Gallery control in horizontal/landscape orientation and at the top of a Gallery control in vertical/portrait orientation. 在模板中执行的任何更改都会反映在整个“库”控件中。Any changes that you make in the template are reflected throughout the Gallery control.

不仅可以预定义库模板来显示图像、文本,还可以使用库来显示高度不同的项。Predefined Gallery templates for showing images, text as well as a gallery with variable height items are available.

关键属性Key properties

Default - 应用启动时,要在库中选择的数据源项或记录。Default – The item or record from the data source to be selected in the gallery when the app starts up.

Items – 控件中显示的数据源,如库、列表或图表。Items – The source of data that appears in a control such as a gallery, a list, or a chart.

Selected - 选定项。Selected – The selected item.

其他属性Additional properties

AllItems - 库中的所有项,其中包括属于库模板的附加控件值。AllItems – All items in a gallery, including additional control values that are a part of the gallery's template.

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 – 此控件是允许用户输入 (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.

Layout - 用户在滚动浏览库时是从上向下(垂直)还是从左向右(水平)滚动滑块。Layout – Whether the user scrolls through a gallery or adjusts a slider top to bottom (Vertical) or left to right (Horizontal).

NavigationStep - 当库的“ShowNavigation”属性设为“true”,且用户选择库任意一端的导航箭头时,库的滚动距离。NavigationStep – How far a gallery scrolls if its ShowNavigation property is set to true and the user selects a navigation arrow at either end of that gallery.

ShowNavigation - 是否在库的每一端显示一个箭头,以便用户可以通过单击或点击箭头滚动浏览库中的项。ShowNavigation – Whether an arrow appears at each end of a gallery so that a user can scroll through the items in the gallery by clicking or tapping an arrow.

ShowScrollbar - 当用户将鼠标悬停在库之上时,是否显示滚动条。ShowScrollbar – Whether a scrollbar appears when the user hovers over a gallery.

Snap - 当用户滚动浏览库时,库是否会自动对齐,以便完整显示下一项。Snap – Whether, when a user scrolls through a gallery, it automatically snaps so that the next item appears in full.

TemplateFill - 库的背景色。TemplateFill – The background color of a gallery.

TemplatePadding - 库中各项之间的距离。TemplatePadding – The distance between items in a gallery.

TemplateSize - 当库为垂直/纵向时,模板的高度;当库为水平/横向时,模板的宽度。TemplateSize – The height of the template for a gallery in vertical/portrait orientation or the width of the template for a gallery in horizontal/landscape orientation.

Transition - 当用户将鼠标悬停在库中一项之上时的视觉效果(“Pop”、“Push”或“None”)。Transition – The visual effect (Pop, Push, or None) when the user hovers over an item in a gallery.

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

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

WrapCount - 每行或每列(具体取决于是水平布局还是垂直布局)显示的项数。WrapCount – Number of items shown per row or column based on horizontal or vertical layout.

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

Filter( DataSource, Formula )Filter( DataSource, Formula )

示例Examples

显示和筛选数据Show and filter data

从用户获取数据Get data from the user