Skip to main content

Module items

Module items 

Source
Expand description

Lists: an ItemsHost keeps one template instance per item of an ItemsControl / ListView / ContentPresenter, reconciled by key, so an update only patches what changed. With a fixed item_height only the rows in (and near) view are built — the rest are two spacers.

Generated code drives it like this:

ⓘ
let mut it = self.l0.begin(root, u);
for (index, item) in vm.visible().enumerate() {
    let selected = bind::is_selected(&sel, &item.id);
    let Some(row) = it.next(bind::key(&item.id), selected, __T0::build) else { continue };
    if row.inst.b0.set(bind::text(&item.name)) { row.w.at_path_mut(&[0]).set_text(...); row.u.relayout(); }
}
if let Some((w, u)) = it.finish(Some(__E0)) { /* empty-state bindings */ }

Structs§

Item
One item handed to the template’s bindings.
ItemsCursor
An update of an ItemsHost in progress.
ItemsHost
The instances of one list.

Constants§

SELECT
Action::slot of an item container: clicking it selects the item.