CollectionView

Inheritance: Element -> NavigableElement -> VisualElement -> View -> View Xamarin.Forms documentation: CollectionView API / Guide

For details on how the control actually works, please refer to:

Xamarin.Forms documentation. Virtualized Collections

Constructors

Properties

Events

Usages

let items = [ 1 .. 1000 ]

(CollectionView(items)
    (fun item -> Label($"{item}")))
    .selectionMode(SelectionMode.Single)
    .onItemTapped(ItemTapped)
    
type Group(headerData: string, footerData: string, items: IEnumerable<int>) =
    inherit ObservableCollection<int>(items)
    member _.HeaderData = headerData
    member _.FooterData = footerData
    
let groups =
    ObservableCollection<Group>(
        [ for i in 0 .. 100 do
            Group($"Header {i}", $"Footer {i}", [1 .. 100]) ]
    )

GroupedCollectionView(groups)
    (fun group -> Label(group.HeaderData))
    (fun item -> Label($"{item}")
    (fun group -> Label(group.FooterData))

Get access to the underlying Xamarin.Forms.CollectionView

let collectionViewRef = ViewRef<CollectionView>()

(CollectionView(items)
    (fun item -> Label($"{item}")))
    .reference(collectionViewRef)

Last updated