CollectionView<TItem, TSection>
| Type parameter | Summary |
|---|---|
(class) TItem | The item type. |
ISection<TItem> TSection | The section model the header and footer templates bind to. |
Properties
AvoidsKeyboard
Whether the collection is inset so the keyboard never covers its content.
Type: bool
DefaultScrollPosition
Where the collection starts after its first nonempty layout, and where a system scroll-to-top gesture (status bar, the selected tab, or the navigation bar) lands.
The default is
ScrollPosition.Top. Set it toScrollPosition.Bottomfor content whose newest entry is at the end, such as a calendar or a chat.
Type: ScrollPosition
EmptyView
Shown instead of the items while the source is empty.
Type: View?
Footer
One view below every section. It scrolls with the collection.
Type: View?
GroupedItemsSource
Groups, each with its own header. Takes precedence over ItemsSource.
Use
IVirtualizedSectionList<TItem, TSection>when section counts and items should be produced without first creating every section model.
Type: BindableList<TSection>
Header
One view above every section. It scrolls with the collection unless PinsHeader is enabled.
Type: View?
IndexTitles
Explicit labels for the fast-scroll index, or null to show one per section.
A tapped letter with no section jumps to the nearest one at or after it.
Has no effect without
SectionIndexTitle, which still supplies each section's letter.
Type: BindableList<string>
IsEditing
Whether the collection is in edit mode, showing selection circles and reorder handles.
IsRefreshing
Whether the refresh spinner is showing.
With a two-way binding, pulling sets it to true and the ViewModel sets it to false when done.
ItemCommand
Command invoked with the tapped item.
Type: ICommand?
ItemContextMenu
Entries in a row's long-press context menu.
Each command is invoked with the row's item.
Type: IList<MenuAction>
ItemPreview
Builds the floating preview shown over a row's context menu, given the row's item.
Without it the row itself is the preview.
ItemTemplate
Builds the element tree for a cell. Called once per recycled cell, never per item.
ItemTemplateSelector
Chooses a strongly typed cell template from each item's runtime type.
Takes precedence over
ItemTemplate. Register every concrete runtime item type before the collection is realized.
Type: ItemTemplateSelector<TItem>?
ItemsSource
The items to show.
Changes animate into place when the list is an
ObservableCollection. AnIVirtualizedList<TItem>is read directly by index without creating a snapshot.
Type: BindableList<TItem>
KeyboardDismiss
How dragging the collection dismisses the keyboard.
Type: KeyboardDismiss
Layout
How the items are arranged.
Type: CollectionLayout
LoadMoreCommand
Invoked when the user scrolls within LoadMoreThreshold items of the end.
Fires once per item count.
Type: ICommand?
LoadMoreCommandParameter
The parameter passed to LoadMoreCommand.
Type: object?
LoadMoreThreshold
How many items from the end LoadMoreCommand fires at.
Type: int
PinsHeader
Keeps Header visible at the collection's top edge while its content scrolls beneath it.
Type: bool
Prefetch
Maps an item to the image url to warm before its row scrolls on.
Setting it enables prefetching through the app's image loader.
PreviewCommand
Invoked with the row's item when its context-menu preview is tapped.
Type: ICommand?
PreviewShape
Shapes the row itself as the lifted platter: padding around the content and a corner radius.
Null keeps the system shape.
Type: PreviewShape?
RefreshCommand
Command invoked when the user pulls to refresh.
Setting it installs the refresh control. The
ICommand.CanExecutecontrols whether the user can pull to refresh.
Type: ICommand?
RefreshCommandParameter
The parameter passed to RefreshCommand.
Type: object?
ReorderCommand
Invoked after a drag-to-reorder with an ItemMove<TItem>.
Setting it enables a long-press drag, unless a context menu owns that gesture; the edit-mode handle always drags.
The move is already applied to the source when it fires.
Type: ICommand?
RetainsHighlight
Whether a highlighted row keeps its background until the page next appears.
The row appearance is defined by
ItemView<TItem>.HighlightBackground. With a selection binding a false value still shows the selection checkmark; only the background is released.
Type: bool
Scrolled
Invoked as the collection scrolls, with the vertical offset in points.
SectionFooterTemplate
Builds a footer for each section. Bound to the section model.
Type: Func<ItemView<TSection>>?
SectionHeaderTemplate
Builds a header for each section. Bound to the section model.
Type: Func<ItemView<TSection>>?
SectionIndexTitle
Maps a section to its letter in the fast-scroll index, or null for no index.
Grouped list layouts only. Tapping a letter jumps to that section.
SectionLayout
Gives each section its own layout, or null to arrange every section with Layout.
Mixes arrangements in one collection, like a carousel row above a list. Every section shares the configured item template or selector.
Type: Func<TSection, CollectionLayout>?
SelectedItem
The selected item in single-selection mode, or null for no selection.
Binding it enables single selection: taps replace the selection, and a two-way binding pushes the tapped item to the source. Use
SelectsOnlyWhileEditingto keep normal taps as activation. Bind either this orSelectedItems, never both.
Type: Bindable<TItem?>
SelectedItems
The selected items in multiple-selection mode, or null for no selection.
Binding it enables multiple selection: taps toggle rows, and mutating the bound collection moves the selection. Give it an
ObservableCollectionso taps can write back. UseSelectsOnlyWhileEditingto keep normal taps as activation. Bind either this orSelectedItem, never both.
Type: BindableList<TItem>
SelectsOnlyWhileEditing
Whether taps change the selection only while editing. Defaults to false.
When true, normal taps only activate:
ItemCommandruns and the transient highlight behaves as if no selection were bound. Edit mode selects with the shape ofSelectedItemorSelectedItems.
Type: bool
SeparatorInsets
Leading/trailing insets for the separator lines, or null for the system default.
List layouts only.
Type: Thickness?
ShowsIndicator
Whether the scroll indicator is shown.
Type: bool
ShowsSelectionCheckmark
Whether selected rows show a trailing checkmark drawn by the collection.
Type: bool
ShowsSeparators
Whether rows draw their separator lines.
List layouts only.
Type: bool
SwipeActions
Actions revealed by swiping a row.
List layouts only.
Type: IList<SwipeAction>
Methods
MeasureOverride
Content measurement. Panels recurse; controls delegate to the native SizeThatFits.
| Parameter | Summary |
|---|---|
Size availableSize | The size available for the view's content. |
Returns
Size: The desired content size.
ScrollTo
Scrolls to the beginning, middle, or end of the collection's content.
| Parameter | Summary |
|---|---|
ScrollPosition position | The content position to reveal. |
(optional) bool animated | Whether the scroll is animated. |
ScrollTo
Scrolls the list until item is visible, aligned to the given viewport edge.
| Parameter | Summary |
|---|---|
TItem item | The item to bring into view. |
(optional) ScrollPosition position | The viewport edge the item aligns to. |
(optional) bool animated | Whether the scroll is animated. |
ScrollTo
Scrolls an indexed item into view.
| Parameter | Summary |
|---|---|
int section | The zero-based section index. |
int item | The zero-based item index within the section. |
(optional) ScrollPosition position | Where the item lands in the viewport. |
(optional) bool animated | Whether the scroll is animated. |