Extensions Module
Functions and values
| Function or value |
Description
|
Full Usage:
BindItemsSource (this, source, keyOf)
Parameters:
ItemsControl
source : IObservable<IReadOnlyList<'T>>
keyOf : 'T -> 'K
Returns: ItemsControl
Type parameters: 'T, 'K (requires equality and equality) |
Bind an observable of item snapshots to the control's ItemsSource.
ItemsSource is assigned once; each snapshot applies as minimal
insert, remove, replace, and move deltas on an owned collection, so
item containers and selection survive edits. Items are matched by
keyOf; keys must be unique within a snapshot. Emissions must arrive
on the UI thread; Program dispatch guarantees this for model
streams.
Returns the control, so the call chains in NXUI-style builders.
Like BindStream, the binding needs no disposal: it keeps applying
snapshots while the control is alive — including while detached
from the visual tree — and ends itself on the first emission after
the control is collected.
A snapshot that repeats a key throws ArgumentException. Bound
inside a Program view, the throw surfaces through the program's
OnError handler.
F# model lists qualify as snapshots; upcast the observable once:
Observable.map (fun m -> m.Items :> IReadOnlyList
|
Full Usage:
BindItemsSourceStructural (this, source)
Parameters:
ItemsControl
source : IObservable<IReadOnlyList<'T>>
Returns: ItemsControl
Type parameters: 'T (requires equality) |
Bind an observable of item snapshots to the control's ItemsSource using structural equality, without keys. Prefer the keyed overload: it also matches moved items. Emissions must arrive on the UI thread. Returns the control, for chaining; like BindStream, the binding needs no disposal and ends once the control is collected.
|
MVUish.Avalonia