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.
Members
TYPEto_refcomponent_propertyconstructnewwith_viewcomponentset_componentset_viewset_parent_owner
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<ComponentHost>
Returns a strong reference to this object.
component_property
fn component_property() -> &'static StyledProperty<Option<String>>
Defines the Component property: the name of a component
registered with register_component.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
A host with nothing to show.
with_view
fn with_view<E: crate::IntoElement>(view: impl Fn() -> E + 'static) -> Ref<Self>
A host that shows the element view makes.
component
fn component(self: &Self) -> Option<String>
The name of the registered component the host shows.
set_component
fn set_component(self: &Self, name: Option<String>)
Shows the registered component named name.
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.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeIntoValue<T>IntoProp<T, Value>Borrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherControlImplExtDerefUpcast<T>Upcast<ComponentHost>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImplStyledElementImplLayoutableImplInteractiveImplInputElementImplControlImplVisualImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.