Link Search Menu Expand Document


List

Based on Collection

Description

The list presents a static or dynamic list of items. The list can be set to be scrollable through the IsScrollable property. items can be made selectable. Items can be arranged vertically or horizontally. The items can overflow or be wrapped to create flowing lists.

Examples

Static list:

<List BackgroundColor="White">
  <ListItem Size="100;30">
    <Label Text="Item 1" AutoSize="True" Alignment="Left" 
           Margin="10,0,0,0" />
  </ListItem>
  <ListItem Size="100;30">
    <Label Text="Item 2" AutoSize="True" Alignment="Left" 
           Margin="10,0,0,0" />
  </ListItem>
  <ListItem Size="100;30">      
    <Label Text="Item 3" AutoSize="True" Alignment="Left" 
           Margin="10,0,0,0" />
    <CheckBox Alignment="Right" />
  </ListItem>
</List>  

Dynamic list:

<List Items="{fruit in @Fruits}" BackgroundColor="White">
  <ListItem Width="150">
    <Image Sprite="{fruit.Icon}" Alignment="Left" Offset="10,0,0,0" />
    <Label Text="{fruit.Name}" AutoSize="True" Alignment="Left" 
           Margin="40,0,0,0" />
  </ListItem>
</List>

See the Lists tutorial for information on how to create scrollable lists, virtualized lists, flowing lists, paged lists and more.

Dependency Properties

Name Type Description
Alignment ElementAlignment Used to align the view relative to the layout parent region it resides in.
Alpha float Can be used to adjust the alpha color of this view and all its children. E.g. used for fade in/out animations. Is separate from and different from the background color of the view as it affects the children as well.
AlternateItems bool Boolean indicating if the state of every other (odd) list items should be Alternate by default. Used to alternate the style of list items.
BackgroundAlphaHitTestMinimumThreshold float Alpha values less than the threshold will cause raycast events to pass through the view.
BackgroundColor Color Background color of the view. Color values can be specified by name (Red, Blue, Coral, etc), hexcode (#aarrggbb or #rrggbb) or rgb/rgba value (“1.0,0.0,0.5” or “1,1,1,0.5”).
BackgroundFillAmount float Amount of the view shown when BackgroundType is set to Filled.
BackgroundFillCenter bool Boolean indicating if the center of a Tiled or Sliced sprite should be rendered.
BackgroundFillClockwise bool Boolean indicating if the sprite should be filled clockwise or counter-clockwise.
BackgroundFillMethod FillMethod Enum indicating the background fill method.
BackgroundFillOrigin int Point of origin of the Fill process. Value means different things with each fill method.
BackgroundIsMaskingGraphic bool Boolean indicating if image is a masking graphic.
BackgroundMaskable bool Boolean indicating if the graphic allows masking.
BackgroundMaterial Material Material used by the sprite.
BackgroundOnCullStateChanged CullStateChangedEvent Callback called when the culling state of this graphic either becomes culled or visible.
BackgroundOverrideSprite Sprite Overrides the default sprite used by this view.
BackgroundPixelsPerUnitMultiplier float Pixel per unit modifier to change how sliced sprites are generated.
BackgroundPreserveAspect bool Boolean indicating if this sprite should preserve its aspect ratio.
BackgroundRaycastTarget bool Boolean indicating if the graphic should be considered a target for raycasting.
BackgroundSprite Sprite The background sprite of the view. The value is the name of the sprite asset file without extension, e.g. “mysprite”.
BackgroundType Type Enum indicating what type of sprite the background is.
BackgroundUseSpriteMesh bool Boolean indicating if the view should use mesh generated by TextureImporter or a simple quad mesh.
BubbleNotifyChildLayoutChanged bool Boolean indicating if parent always should be notified when the child changes layout.
CanDeselect bool Boolean indicating if selected list items can be deselected by clicking on them again.
CanMultiSelect bool Boolean indicating if the user can select multiple list items.
CanReselect bool Boolean indicating if the selected item should be reselected if clicked on again.
CanSelect bool Boolean indicating if the user can select items in the list.
ContentAlignment ElementAlignment Alignment of the list items.
DeselectAfterSelect bool Boolean indicating if the item should immediatelly be deselected after being selected.
DisableItemArrangement bool Boolean indicating if the list shouldn’t arrange its items. Used if items are arranged elsewhere.
DisableLayoutUpdate bool Boolean indicating if automatic layout updates for this view should be disabled. When disabled the view doesn’t call UpdateLayout() when properties such as Width, Height, etc. changes.
EnableScriptEvents bool Boolean indicating if unity script events (Update, LateUpdate, Awake, etc) should be relayed to the view code-behind through the corresponding methods that can be overriden.
GameObject GameObject GameObject in the hierarchy that corresponds to the view.
Height ElementSize The height of the view in pixels or percents.
HorizontalSpacing ElementSize Horizontal spacing between the list items.
IgnoreFlip bool Used when doing localization override default behavior of flipping the view Right to Left or Left to Rigth.
IgnoreObject bool Boolean indicating if the view should be ignored. Ignored objects don’t run any load logic and don’t respond to property changed events.
IsActive bool Boolean indicating if the view is active. Deactivated views deactivates corresponding game object, components, renderers and scripts.
IsPaged bool Boolean indicating if the list is paged. Customize paging through, e.g. PageSize and ShowNavigationButtons properties.
IsScrollable bool Boolean indicating if the list can be scrolled.
IsStatic bool Boolean indicating if the list is static.
IsVirtualized bool Boolean indicating if the list is virtualized. Virtualized lists have far better performance when dealing with large number of items as only items visible in the viewport are generated.
IsVisible bool Boolean indicating if view is visible or hidden. Invisible views still take up space but aren’t interactable and have their alpha set to 0.
Items BindableCollection The data collection that is used to generate the collection view items.
LoadMode LoadMode Enum flags indicating when and how the view should be loaded by the framework. Can be changed when e.g. the view is to be loaded on-demand.
Margin ElementMargin Adding margins to a view changes the size of the area in which its content resides, but it does not change the width or height of the view.
MaskContent bool Boolean indicating if content of the view should be masked.
Offset ElementMargin Determines the offset of the view.
OffsetFromParent ElementMargin Offset set by a parent view. Used by views like Group to arrange children without changing their own Offset values.
Orientation ElementOrientation Orientation of the list.
Overflow OverflowMode Enum indicating if items should overflow or wrap as they reach the boundaries of the list. Used to create flowing lists.
OverrideHeight ElementSize Overrides regular Height value. Used to e.g. automatically size items without changing the default Height value set.
OverrideWidth ElementSize Overrides regular Width value. Used to e.g. automatically size items without changing the default Width value set.
Padding ElementMargin Adds padding to the list.
PageIndex int Zero-based index of the current page being displayed if IsPaged is set to true.
PageNavigationGroupAlignment ElementAlignment Default alignment of page navigation button group.
PageNavigationGroupOffset ElementMargin Default offset of page navigation button group.
PageNavigationGroupOrientation ElementOrientation Default orientation of page navigation button group.
PageNavigationGroupSpacing ElementSize Default spacing of page navigation button group.
PageSize int Number of items to be shown per page when IsPaged is set to true.
Pivot Vector2 The pivot point of the view.
Position Vector3 Directly sets the local position of the view relative to parent. Position otherwise set using the Alignment and Offset properties.
RaycastBlockMode RaycastBlockMode Enum indicating if raycasts should be blocked.
RealizationMargin Vector2 Used when IsVirtualized is set to true and determines how close the list item needs to be to the visible viewport in order to be realized.
Rotation Quaternion Rotation of the view.
Scale Vector3 Scale of the view.
SelectedItem BindableObject References the data collection item that corresponds to the currently selected list item.
SelectOnMouseUp bool Boolean indicating if list items should be selected on mouse up.
ShowNavigationButtons NavigationButtonsVisibility Enum indicating which navigation buttons should be shown when list is paged.
SortDirection ElementSortDirection Determines the sort direction of the list items.
Spacing ElementSize Horizontal and vertical spacing between the list items.
UseFastShader bool Boolean indicating if the default UI shader should be replaced by a simpler and faster one. The faster shader does not support masking and clipping.
VerticalSpacing ElementSize Vertical spacing between the list items.
Width ElementSize The width of the view in pixels or percents.