ListView

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

For details on how the control actually works, please refer to the Xamarin.Forms documentation. Virtualized Collections

Constructors

Properties

Events

Usages

let items = [ 1 .. 1000 ]

(ListView(items)
    (fun item -> TextCell($"{item}")))
    .header(Label("I'm a header"))
    .footer(Label("I'm a footer"))
    .hasEvenRows(true)
    .horizontalScrollBarVisibility(ScrollBarVisibility.Never)
    .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]) ]
    )

// ListView has no Footer for groups
GroupedListView(groups)
    (fun group -> TextCell(group.HeaderData))
    (fun item -> TextCell($"{item}"))

Get access to the underlying Xamarin.Forms.ListView

let listViewRef = ViewRef<ListView>()
(ListView(items)
    (fun item -> TextCell($"{item}")))
    .reference(listViewRef)

Last updated