FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    DeferredElement

    struct · ferroui-markup-xaml · v0.5.0

    struct DeferredElement
    

    The placeholder of an element with x:Load (or x:DeferLoadStrategy="Lazy").

    The compiler replaces the element by a placeholder that holds it as deferred content (content, built as a template is) with its name (element_name) and the value of x:Load (load, a literal or an {x:Bind}). The placeholder takes no room and is not shown. When Load becomes true (or find_name asks for the element), the element is built and takes the place of the placeholder in its parent (a panel, a decorator or a content control); when Load becomes false the placeholder takes its place again and the element is released, so that loading it again builds a new one (WinUI's UnloadObject).

    The element is built with the root of its document and a name scope of its own, a child of the one of the document: its x:Bind bindings read the root of the document (or the item of the template instance it is in, or its templated parent), and its named elements are found in that scope, from it and through find_name. Inside a control template the element is given the templated parent of the template instance, so that a bound x:Load in a control template works as in a page (WinUI's fix of bound x:Load in control templates).

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<DeferredElement>
    

    Returns a strong reference to this object.

    Source

    load_property

    fn load_property() -> &'static StyledProperty<bool>
    

    x:Load: whether the element is loaded.

    Source

    placeholder_property

    fn placeholder_property() -> &'static AttachedProperty<Option<Ref<DeferredElement>>>
    

    The placeholder a loaded element replaces, which the element holds while it is loaded.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data; see ferroui_base::FerroObject::construct.

    Source

    new

    fn new() -> Ref<Self>
    

    Source

    element_name

    fn element_name(self: &Self) -> Option<String>
    

    The x:Name of the deferred element.

    Source

    set_element_name

    fn set_element_name(self: &Self, value: Option<String>)
    

    Source

    content

    fn content(self: &Self) -> Option<BoxedValue>
    

    The deferred element: deferred content, built as the content of a template is.

    Source

    set_content

    fn set_content(self: &Self, value: Option<BoxedValue>)
    

    Source

    is_load_requested

    fn is_load_requested(self: &Self) -> bool
    

    The value of x:Load.

    Source

    set_load

    fn set_load(self: &Self, value: bool)
    

    Source

    loaded_element

    fn loaded_element(self: &Self) -> Option<Ref<Control>>
    

    The element, while it is loaded.

    Source

    error

    fn error(self: &Self) -> Option<String>
    

    Why the last change of Load could not be applied (a placeholder whose parent does not hold it as a child, content that is not a control), if it could not.

    Source

    load

    fn load(self: &Self) -> Result<Option<Ref<Control>>, XamlLoadError>
    

    Builds the element and puts it in the place of the placeholder (FindName of WinUI on a deferred element); the element when it is already loaded. None while the placeholder has no parent, or when the content builds nothing.

    Source

    unload

    fn unload(self: &Self)
    

    Puts the placeholder back in the place of the loaded element and releases the element (UnloadObject).

    Source

    find_name

    fn find_name(scope: &StyledElement, name: &str) -> Result<Option<Ref<FerroObject>>, XamlLoadError>
    

    WinUI's FindName with the realization of x:Load: the element named name in the name scope of scope, else a deferred element of that name among the logical descendants of scope, loaded if it is not, else a named element of a loaded deferred element.

    Source

    Trait implementations

    Availability

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