FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ComponentHost

    struct · ferroui-view · v0.5.0

    struct ComponentHost
    

    A control that shows an element: a component hosted in XAML, an item of a data template (template), or any element placed in a tree of controls made otherwise.

    The element is mounted when the host is given it and when the host is attached to the visual tree again; it is disposed (its effects, hooks and handlers end) when the host is detached from the visual tree. Components inside read the DataContext of the host with use_data_context.

    In XAML, the Component property names a component registered with register_component.

    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<ComponentHost>
    

    Returns a strong reference to this object.

    Source

    component_property

    fn component_property() -> &'static StyledProperty<Option<String>>
    

    Defines the Component property: the name of a component registered with register_component.

    Source

    construct

    fn construct() -> Self
    

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

    Source

    new

    fn new() -> Ref<Self>
    

    A host with nothing to show.

    Source

    with_view

    fn with_view<E: crate::IntoElement>(view: impl Fn() -> E + 'static) -> Ref<Self>
    

    A host that shows the element view makes.

    Source

    component

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

    The name of the registered component the host shows.

    Source

    set_component

    fn set_component(self: &Self, name: Option<String>)
    

    Shows the registered component named name.

    Source

    set_view

    fn set_view<E: crate::IntoElement>(self: &Self, view: impl Fn() -> E + 'static)
    

    Shows the element view makes, in place of what the host showed.

    Source

    set_parent_owner

    fn set_parent_owner(self: &Self, parent: Option<Owner>)
    

    Mounts the content under parent (an owner whose contexts it sees) instead of the owner that was current when the view was given.

    Source

    Trait implementations

    Availability

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