FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ferro_markup_list

    macro · ferroui-controls · v0.5.0

    macro_rules! ferro_markup_list
    

    Declares the notifying list of Item values (FerroList<Item>) to markup: the counterpart of an ObservableCollection<T> / IList<T> property type of the managed original.

    // The lists of a view model:
    ferro_markup_list!(pub CursorList: Rc<StandardCursorModel>);
    
    ferro_markup_type!(class CursorPageViewModel {
        ..
        properties: [StandardCursors: FerroList<Rc<StandardCursorModel>> { get: .. }],
    });
    
    // In the crate's `register_types()`:
    CursorList::register();
    

    The declaration states the element type, which is what the XAML compiler needs to infer the data type of an item template from the collection its items control is bound to ([InheritDataTypeFromItems]) and to type an indexer of a binding path. It generates a carrier type named as given, with the markup metadata of the list (the instantiation FerroList`1 of the item type: a constructor, Count, Add, the indexer) and register(), which makes the metadata known and lets bindings deliver the list to an items source property and an indexer of a binding path follow its changes, on every thread.

    View source

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.