FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Visual

    struct · ferroui-base · v0.5.0

    struct Visual
    

    Base class for controls that provides rendering and related visual properties.

    The visual class represents elements that have a visual on-screen representation and stores all the information needed for a renderer to render the control. To traverse the visual tree, use the methods in the visual_tree module.

    View source

    Members

    calculate_distance_from_ancestor

    fn calculate_distance_from_ancestor(self: &Self, ancestor: Option<&Visual>) -> Option<usize>
    

    Calculates the distance from a visual's ancestor.

    Returns the number of steps from the visual to the ancestor, or None if this visual is not a descendent of ancestor. With no ancestor given, never matches and returns None.

    Source

    calculate_distance_from_root

    fn calculate_distance_from_root(self: &Self) -> usize
    

    Calculates the distance from a visual's root.

    Source

    find_common_visual_ancestor

    fn find_common_visual_ancestor(self: &Self, target: &Visual) -> Option<Ref<Visual>>
    

    Tries to get the first common ancestor of two visuals.

    Source

    get_visual_ancestors

    fn get_visual_ancestors(self: &Self) -> VisualAncestors
    

    Enumerates the ancestors of the visual in the visual tree.

    Source

    get_self_and_visual_ancestors

    fn get_self_and_visual_ancestors(self: &Self) -> VisualAncestors
    

    Enumerates the visual and its ancestors in the visual tree.

    Source

    find_ancestor_of_type

    fn find_ancestor_of_type<T: ObjectType>(self: &Self, include_self: bool) -> Option<Ref<T>>
    

    Finds the first ancestor of class T, optionally starting with the visual itself.

    Source

    find_ancestor_of_type_where

    fn find_ancestor_of_type_where<T: ObjectType>(self: &Self, include_self: bool, predicate: impl Fn(&T) -> bool) -> Option<Ref<T>>
    

    Finds the first ancestor of class T that matches a predicate, optionally starting with the visual itself.

    Source

    find_descendant_of_type

    fn find_descendant_of_type<T: ObjectType>(self: &Self, include_self: bool) -> Option<Ref<T>>
    

    Finds the first descendant of class T (depth first), optionally starting with the visual itself.

    Source

    find_descendant_of_type_where

    fn find_descendant_of_type_where<T: ObjectType>(self: &Self, include_self: bool, predicate: impl Fn(&T) -> bool) -> Option<Ref<T>>
    

    Finds the first descendant of class T that matches a predicate (depth first), optionally starting with the visual itself.

    Source

    get_transformed_bounds

    fn get_transformed_bounds(self: &Self) -> Option<TransformedBounds>
    

    Gets the bounds of the visual in the coordinate space of its root, with the clip applied by its ancestors. Returns None if the visual or one of its ancestors is invisible.

    Source

    get_visual_at

    fn get_visual_at(self: &Self, p: Point) -> Option<Ref<Visual>>
    

    Gets the first visible visual at a point, in the coordinates of this visual.

    Source

    get_visual_at_filtered

    fn get_visual_at_filtered(self: &Self, p: Point, filter: &dyn Fn(&Visual) -> bool) -> Option<Ref<Visual>>
    

    Gets the first visual at a point, in the coordinates of this visual.

    If filter returns false for a visual then the visual and all its descendants are excluded from the results.

    Source

    get_visual_at_geometry

    fn get_visual_at_geometry(self: &Self, geometry: &Geometry) -> Option<GeometryHitTestResult>
    

    Gets the first visible visual intersecting a geometry, in the coordinates of this visual, with the details of the intersection.

    Source

    get_visual_at_geometry_filtered

    fn get_visual_at_geometry_filtered(self: &Self, geometry: &Geometry, filter: &dyn Fn(&Visual) -> bool) -> Option<GeometryHitTestResult>
    

    Gets the first visual intersecting a geometry, in the coordinates of this visual, with the details of the intersection.

    If filter returns false for a visual then the visual and all its descendants are excluded from the results.

    Source

    get_visuals_at

    fn get_visuals_at(self: &Self, p: Point) -> Vec<Ref<Visual>>
    

    Enumerates the visible visuals at a point, in the coordinates of this visual, topmost first.

    Source

    get_visuals_at_filtered

    fn get_visuals_at_filtered(self: &Self, p: Point, filter: &dyn Fn(&Visual) -> bool) -> Vec<Ref<Visual>>
    

    Enumerates the visuals at a point, in the coordinates of this visual, topmost first.

    If filter returns false for a visual then the visual and all its descendants are excluded from the results.

    Source

    get_visuals_at_geometry

    fn get_visuals_at_geometry(self: &Self, geometry: &Geometry) -> Vec<GeometryHitTestResult>
    

    Enumerates the visible visuals intersecting a geometry, in the coordinates of this visual, topmost first, with the details of the intersections.

    Source

    get_visuals_at_geometry_filtered

    fn get_visuals_at_geometry_filtered(self: &Self, geometry: &Geometry, filter: &dyn Fn(&Visual) -> bool) -> Vec<GeometryHitTestResult>
    

    Enumerates the visuals intersecting a geometry, in the coordinates of this visual, topmost first, with the details of the intersections.

    If filter returns false for a visual then the visual and all its descendants are excluded from the results.

    Source

    get_visual_children

    fn get_visual_children(self: &Self) -> Rc<Vec<Ref<Visual>>>
    

    Gets a snapshot of the visual children of the visual.

    Source

    get_visual_descendants

    fn get_visual_descendants(self: &Self) -> VisualDescendants
    

    Enumerates the descendants of the visual in the visual tree, in depth-first pre-order.

    Source

    get_self_and_visual_descendants

    fn get_self_and_visual_descendants(self: &Self) -> VisualDescendants
    

    Enumerates the visual and its descendants in the visual tree, in depth-first pre-order.

    Source

    get_visual_parent

    fn get_visual_parent(self: &Self) -> Option<Ref<Visual>>
    

    Gets the visual parent of the visual.

    Source

    get_visual_parent_of_type

    fn get_visual_parent_of_type<T: ObjectType>(self: &Self) -> Option<Ref<T>>
    

    Gets the visual parent of the visual, if it is of class T.

    Source

    get_visual_root

    fn get_visual_root(self: &Self) -> Option<Ref<Visual>>
    

    The root visual of the presentation source the visual is attached to.

    Source

    get_layout_root

    fn get_layout_root(self: &Self) -> Option<Rc<dyn ILayoutRoot>>
    

    The layout root of the tree the visual is attached to.

    Source

    get_layout_manager

    fn get_layout_manager(self: &Self) -> Option<Rc<dyn ILayoutManager>>
    

    The layout manager of the presentation source of the visual, or None when the visual is not attached to a visual root.

    Source

    get_input_root

    fn get_input_root(self: &Self) -> Option<Rc<dyn IInputRoot>>
    

    The input root of the tree the visual is attached to.

    Source

    get_platform_settings

    fn get_platform_settings(self: &Self) -> Option<Rc<dyn IPlatformSettings>>
    

    The platform settings of the tree the visual is attached to.

    Source

    is_visual_ancestor_of

    fn is_visual_ancestor_of(self: &Self, target: &Visual) -> bool
    

    Tests whether this visual is an ancestor of target.

    Source

    sort_by_z_index

    fn sort_by_z_index(elements: &[Ref<Visual>]) -> Vec<Ref<Visual>>
    

    Sorts visuals for hit testing: by descending Z index, and for equal Z indices by descending position in the input, so that the topmost visual comes first.

    Source

    point_to_client

    fn point_to_client(self: &Self, point: PixelPoint) -> Point
    

    Converts a point from screen to client coordinates.

    Panics if the visual does not belong to a visual tree.

    Source

    point_to_screen

    fn point_to_screen(self: &Self, point: Point) -> PixelPoint
    

    Converts a point from client to screen coordinates.

    Panics if the visual does not belong to a visual tree.

    Source

    transform_to_visual

    fn transform_to_visual(self: &Self, to: &Visual) -> Option<Matrix>
    

    Returns a transform that transforms the visual's coordinates into the coordinates of the specified to visual, or None if the visuals don't share a common ancestor.

    Source

    translate_point

    fn translate_point(self: &Self, point: Point, relative_to: &Visual) -> Option<Point>
    

    Translates a point relative to this visual to coordinates that are relative to the specified visual, or returns None if the visuals don't share a common ancestor.

    Source

    rotation

    fn rotation(self: &Self) -> f32
    

    UIElement.Rotation: the rotation of the element in degrees, clockwise, around rotation_axis through center_point. Zero until set.

    Around the Z axis it is the RotationAngle of the composition visual (in radians); around another axis it is the Orientation of the composition visual, a quaternion. While neither the rotation nor its axis was set, both are left to the application.

    Source

    set_rotation

    fn set_rotation(self: &Self, value: f32)
    

    Sets rotation.

    Source

    rotation_axis

    fn rotation_axis(self: &Self) -> Vector3
    

    UIElement.RotationAxis: the axis rotation turns the element around. The Z axis (0, 0, 1) until set.

    Deviation (winui-composition.md): the renderers are 2D, so a rotation around another axis shows only its projection on the plane of the element (no perspective). A zero axis is taken as the Z axis.

    Source

    set_rotation_axis

    fn set_rotation_axis(self: &Self, value: Vector3)
    

    Sets rotation_axis.

    Source

    scale

    fn scale(self: &Self) -> Vector3
    

    UIElement.Scale: the scale of the element around center_point, the Scale of its composition visual. (1, 1, 1) until set.

    Source

    set_scale

    fn set_scale(self: &Self, value: Vector3)
    

    Sets scale.

    Source

    center_point

    fn center_point(self: &Self) -> Vector3
    

    UIElement.CenterPoint: the point, in the coordinates of the element, that scale and rotation are around; the CenterPoint of its composition visual. The origin until set.

    Source

    set_center_point

    fn set_center_point(self: &Self, value: Vector3)
    

    Sets center_point.

    Source

    transform_matrix

    fn transform_matrix(self: &Self) -> Matrix4x4
    

    UIElement.TransformMatrix: a transform of the element in addition to the other facades. The identity until set.

    The composition visual has a 2D TransformMatrix, which the renderer fills with the render transform of the element; the 2D affine part of this matrix (M11, M12, M21, M22, M41, M42) is applied after the render transform.

    Deviation (winui-composition.md): WinUI applies TransformMatrix after the other facade transforms; the composition visual applies its TransformMatrix before Scale, RotationAngle, Orientation and Translation, so here the matrix acts before those facades. The 3D part of the matrix is ignored.

    Source

    set_transform_matrix

    fn set_transform_matrix(self: &Self, value: Matrix4x4)
    

    Sets transform_matrix.

    Source

    opacity_transition

    fn opacity_transition(self: &Self) -> Option<ScalarTransition>
    

    UIElement.OpacityTransition: animates the changes of the Opacity of the element. None (no animation) by default.

    Source

    set_opacity_transition

    fn set_opacity_transition(self: &Self, value: Option<ScalarTransition>)
    

    Sets opacity_transition.

    Source

    rotation_transition

    fn rotation_transition(self: &Self) -> Option<ScalarTransition>
    

    UIElement.RotationTransition: animates the changes of rotation (and of rotation_axis). None by default.

    Source

    set_rotation_transition

    fn set_rotation_transition(self: &Self, value: Option<ScalarTransition>)
    

    Sets rotation_transition.

    Source

    scale_transition

    fn scale_transition(self: &Self) -> Option<Vector3Transition>
    

    UIElement.ScaleTransition: animates the changes of scale. None by default.

    Source

    set_scale_transition

    fn set_scale_transition(self: &Self, value: Option<Vector3Transition>)
    

    Sets scale_transition.

    Source

    translation_transition

    fn translation_transition(self: &Self) -> Option<Vector3Transition>
    

    UIElement.TranslationTransition: animates the changes of translation. None by default.

    Source

    set_translation_transition

    fn set_translation_transition(self: &Self, value: Option<Vector3Transition>)
    

    Sets translation_transition.

    Source

    shadow

    fn shadow(self: &Self) -> Option<Ref<crate::media::Shadow>>
    

    UIElement.Shadow: the shadow the element casts, a ThemeShadow (the one shadow there is). The shadow of a popup is cast by the child of the popup.

    Source

    set_shadow

    fn set_shadow(self: &Self, value: Option<Ref<crate::media::Shadow>>)
    

    Source

    theme_shadow_caster

    fn theme_shadow_caster(self: &Self) -> Option<(Ref<ThemeShadow>, Ref<Visual>)>
    

    The theme shadow the visual casts and the element whose elevation (the Z of its Translation) the shadow has: its own ThemeShadow, or, for the child of a popup with a theme shadow, the popup's (with the popup's elevation, which wins over the child's own shadow). None for a visual that delegates its shadow to its child (a popup) and for one without a theme shadow.

    Source

    theme_shadow_visual

    fn theme_shadow_visual(self: &Self) -> Option<Rc<ThemeShadowVisual>>
    

    The visual that draws the theme shadow of this visual, while there is one.

    Source

    set_theme_shadow_delegated_to_child

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

    For a popup (WinUI's Popup, whose Shadow is cast by its child): whether the shadow of this visual is cast by its child rather than by itself.

    Source

    set_theme_shadow_popup

    fn set_theme_shadow_popup(self: &Self, popup: Option<&Visual>)
    

    For the child of a popup: the popup whose Shadow the child casts as its own (NeedsDropShadowVisual: "Child of Popup with Shadow is implicitly a shadow caster").

    Source

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

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

    Returns a strong reference to this object.

    Source

    render

    fn render(self: &Self, context: &mut DrawingContext<'_>)
    

    Renders the visual to a drawing context.

    Source

    on_attached_to_visual_tree_core

    fn on_attached_to_visual_tree_core(self: &Self, e: &VisualTreeAttachmentEventArgs)
    

    Calls the on_attached_to_visual_tree method for this control and all of its visual descendants.

    Source

    on_detached_from_visual_tree_core

    fn on_detached_from_visual_tree_core(self: &Self, e: &VisualTreeAttachmentEventArgs)
    

    Calls the on_detached_from_visual_tree method for this control and all of its visual descendants.

    Source

    on_attached_to_visual_tree

    fn on_attached_to_visual_tree(self: &Self, e: &VisualTreeAttachmentEventArgs)
    

    Called when the control is added to a rooted visual tree.

    Source

    on_detached_from_visual_tree

    fn on_detached_from_visual_tree(self: &Self, e: &VisualTreeAttachmentEventArgs)
    

    Called when the control is removed from a rooted visual tree.

    Source

    on_visual_parent_changed

    fn on_visual_parent_changed(self: &Self, old_parent: Option<&Ref<Visual>>, new_parent: Option<&Ref<Visual>>)
    

    Called when the control's visual parent changes.

    Source

    bypass_flow_direction_policies

    fn bypass_flow_direction_policies(self: &Self) -> bool
    

    Whether the control ignores the flow direction policies, i.e. is never mirrored.

    Source

    invalidate_mirror_transform

    fn invalidate_mirror_transform(self: &Self)
    

    Computes the has_mirror_transform value according to the flow direction of this visual and its parent.

    Source

    clip_to_bounds_radius

    fn clip_to_bounds_radius(self: &Self) -> Option<crate::CornerRadius>
    

    The corner radius the visual clips its content with when clip_to_bounds is set; None for a plain rectangular clip. (Upstream: the IVisualWithRoundRectClip interface.)

    Source

    custom_hit_test

    fn custom_hit_test(self: &Self, point: crate::Point) -> Option<bool>
    

    The custom hit test of the visual at a point in its own coordinates; None when the visual has none and is hit by what it occupies or draws. (Upstream: the ICustomHitTest interface; a class implementing it overrides this and the geometry form.)

    Source

    custom_hit_test_geometry

    fn custom_hit_test_geometry(self: &Self, geometry: &Ref<crate::media::Geometry>) -> Option<crate::media::IntersectionResult>
    

    The custom hit test of the visual against a geometry in its own coordinates; None when the visual has none.

    Source

    ensure_initialized_for_visual_brush

    fn ensure_initialized_for_visual_brush(self: &Self)
    

    Ensures that the visual is ready to use as the visual in a visual brush. (Upstream: the IVisualBrushInitialize interface; a class implementing it overrides this.)

    Source

    detach_from_compositor

    fn detach_from_compositor(self: &Self)
    

    Releases the composition visual of the visual.

    Source

    synchronize_composition_child_visuals

    fn synchronize_composition_child_visuals(self: &Self)
    

    Makes the children of the composition visual match the visual children (in Z order) and the child composition visual.

    Source

    synchronize_composition_properties

    fn synchronize_composition_properties(self: &Self)
    

    Copies the properties of the visual to its composition visual.

    Source

    requires_composition_visual

    fn requires_composition_visual(self: &Self) -> bool
    

    Whether the visual has a composition visual of its own whatever it draws: a class whose create_composition_visual makes a composition visual that shows something itself says so here. Any other visual gets its composition visual once it sets something the compositor applies, or is asked for it (docs/porting/desktop-performance.md, section 9.41); until then what it draws is an item of the composition visual of the nearest visual above it that has one (section 9.42).

    Source

    bounds_property

    fn bounds_property() -> &'static DirectProperty<Visual, Rect>
    

    Defines the Bounds property.

    Source

    clip_to_bounds_property

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

    Defines the ClipToBounds property.

    Source

    clip_property

    fn clip_property() -> &'static StyledProperty<Option<Ref<Geometry>>>
    

    Defines the Clip property.

    Source

    shadow_property

    fn shadow_property() -> &'static StyledProperty<Option<Ref<crate::media::Shadow>>>
    

    Defines the Shadow property (WinUI UIElement.Shadow): the shadow the element casts, a ThemeShadow.

    Source

    translation_property

    fn translation_property() -> &'static DirectProperty<Visual, crate::Vector3D>
    

    Defines the Translation property (WinUI UIElement.Translation): the facade translation as a property markup can set (Translation="0,0,32").

    Source

    cache_mode_property

    fn cache_mode_property() -> &'static StyledProperty<Option<Ref<CacheMode>>>
    

    Defines the CacheMode property.

    Source

    effect_property

    fn effect_property() -> &'static StyledProperty<Option<Rc<dyn IEffect>>>
    

    Defines the Effect property.

    Source

    opacity_mask_property

    fn opacity_mask_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
    

    Defines the OpacityMask property.

    Source

    render_transform_property

    fn render_transform_property() -> &'static StyledProperty<Option<Rc<dyn ITransform>>>
    

    Defines the RenderTransform property.

    Source

    render_transform_origin_property

    fn render_transform_origin_property() -> &'static StyledProperty<RelativePoint>
    

    Defines the RenderTransformOrigin property.

    Source

    is_visible_property

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

    Defines the IsVisible property.

    Source

    opacity_property

    fn opacity_property() -> &'static StyledProperty<f64>
    

    Defines the Opacity property.

    Source

    has_mirror_transform_property

    fn has_mirror_transform_property() -> &'static DirectProperty<Visual, bool>
    

    Defines the HasMirrorTransform property.

    Source

    flow_direction_property

    fn flow_direction_property() -> &'static AttachedProperty<FlowDirection>
    

    Defines the FlowDirection attached property.

    Source

    visual_parent_property

    fn visual_parent_property() -> &'static DirectProperty<Visual, Option<Ref<Visual>>>
    

    Defines the VisualParent property.

    Source

    z_index_property

    fn z_index_property() -> &'static StyledProperty<i32>
    

    Defines the ZIndex property.

    Source

    construct

    fn construct() -> Self
    

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

    Source

    new

    fn new() -> Ref<Self>
    

    Source

    attached_to_visual_tree

    fn attached_to_visual_tree(self: &Self, handler: impl Fn(&VisualTreeAttachmentEventArgs) -> () + 'static) -> Subscription
    

    Raised when the control is attached to a rooted visual tree.

    Source

    detached_from_visual_tree

    fn detached_from_visual_tree(self: &Self, handler: impl Fn(&VisualTreeAttachmentEventArgs) -> () + 'static) -> Subscription
    

    Raised when the control is detached from a rooted visual tree.

    Source

    is_effectively_visible_changed

    fn is_effectively_visible_changed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
    

    Raised when is_effectively_visible changes.

    Source

    bounds

    fn bounds(self: &Self) -> Rect
    

    The bounds of the control relative to its parent.

    Source

    set_bounds

    fn set_bounds(self: &Self, value: Rect)
    

    Sets the bounds of the control. Called by the layout system.

    Source

    clip_to_bounds

    fn clip_to_bounds(self: &Self) -> bool
    

    Whether the control should be clipped to its bounds.

    Source

    set_clip_to_bounds

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

    Source

    clip

    fn clip(self: &Self) -> Option<Ref<Geometry>>
    

    The geometry clip for this visual.

    Source

    set_clip

    fn set_clip(self: &Self, value: impl Into<Nullable<Geometry>>)
    

    Source

    cache_mode

    fn cache_mode(self: &Self) -> Option<Ref<CacheMode>>
    

    The cache mode of the visual.

    Source

    set_cache_mode

    fn set_cache_mode(self: &Self, value: impl Into<Nullable<CacheMode>>)
    

    Source

    effect

    fn effect(self: &Self) -> Option<Rc<dyn IEffect>>
    

    The effect of the control.

    Source

    set_effect

    fn set_effect(self: &Self, value: Option<Rc<dyn IEffect>>)
    

    Source

    opacity_mask

    fn opacity_mask(self: &Self) -> Option<Rc<dyn IBrush>>
    

    The opacity mask of the control.

    Source

    set_opacity_mask

    fn set_opacity_mask(self: &Self, value: Option<Rc<dyn IBrush>>)
    

    Source

    render_transform

    fn render_transform(self: &Self) -> Option<Rc<dyn ITransform>>
    

    The render transform of the control.

    Source

    set_render_transform

    fn set_render_transform(self: &Self, value: Option<Rc<dyn ITransform>>)
    

    Source

    render_transform_origin

    fn render_transform_origin(self: &Self) -> RelativePoint
    

    The transform origin of the control.

    Source

    set_render_transform_origin

    fn set_render_transform_origin(self: &Self, value: RelativePoint)
    

    Source

    is_effectively_visible

    fn is_effectively_visible(self: &Self) -> bool
    

    Whether this control and all its parents are visible.

    Source

    is_visible

    fn is_visible(self: &Self) -> bool
    

    Whether this control is visible.

    Source

    set_is_visible

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

    Source

    opacity

    fn opacity(self: &Self) -> f64
    

    The opacity of the control.

    Source

    set_opacity

    fn set_opacity(self: &Self, value: f64)
    

    Source

    manipulation_transform

    fn manipulation_transform(self: &Self) -> Option<crate::Matrix>
    

    The manipulation transform of the visual (not upstream): a transform its parent applies to it after its render transform and before its position, about its top left corner. The scroll presenter of a zooming scroll viewer scales its content this way (WinUI applies the zoom of DirectManipulation to the content of a scroll viewer); it takes part in rendering, hit testing and the transforms between visuals as the render transform does. None by default.

    Source

    set_manipulation_transform

    fn set_manipulation_transform(self: &Self, value: Option<crate::Matrix>)
    

    Sets manipulation_transform; the identity is no transform.

    Source

    has_mirror_transform

    fn has_mirror_transform(self: &Self) -> bool
    

    Whether the control is mirrored relative to its parent because of its flow direction.

    Source

    set_has_mirror_transform

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

    Sets the mirror transform flag.

    Source

    flow_direction

    fn flow_direction(self: &Self) -> FlowDirection
    

    The text flow direction.

    Source

    set_flow_direction

    fn set_flow_direction(self: &Self, value: FlowDirection)
    

    Source

    get_flow_direction

    fn get_flow_direction(visual: &Visual) -> FlowDirection
    

    Gets the value of the attached FlowDirection property on a visual.

    Source

    set_flow_direction_on

    fn set_flow_direction_on(visual: &Visual, value: FlowDirection)
    

    Sets the value of the attached FlowDirection property on a visual.

    Source

    z_index

    fn z_index(self: &Self) -> i32
    

    The Z index of the control.

    Controls with a higher Z index appear in front of controls with a lower one. Among controls with the same value, order of appearance in the visual children decides.

    Source

    set_z_index

    fn set_z_index(self: &Self, value: i32)
    

    Source

    visual_children

    fn visual_children(self: &Self) -> &FerroList<Ref<Visual>>
    

    The control's child visuals.

    Source

    visual_children_count

    fn visual_children_count(self: &Self) -> usize
    

    The number of visual children, without creating the collection.

    Source

    visual_children_snapshot

    fn visual_children_snapshot(self: &Self) -> Option<Rc<Vec<Ref<Visual>>>>
    

    A snapshot of the visual children, without creating the collection.

    Source

    visual_root

    fn visual_root(self: &Self) -> Option<Ref<Visual>>
    

    The root of the visual tree, if the control is attached to one.

    Source

    has_composition_visual

    fn has_composition_visual(self: &Self) -> bool
    

    Whether the visual has a composition visual of its own now. A visual attached to a tree that has none is shown by the composition visual of the nearest visual above it that has one: what the visual draws is an item of that composition visual (has_composition_item), and the composition visuals of the visuals under it are its children (docs/porting/desktop-performance.md, sections 9.41 and 9.42).

    Source

    has_composition_item

    fn has_composition_item(self: &Self) -> bool
    

    Whether what the visual draws is shown now by the composition visual of the nearest visual above it that has one, as an item of it: the visual has no composition visual of its own (docs/porting/desktop-performance.md, section 9.42).

    Source

    composition_visuals_on_demand

    fn composition_visuals_on_demand() -> bool
    

    Whether visuals get their composition visuals on demand (the default), or each of them when it is attached to a visual tree.

    Source

    set_composition_visuals_on_demand

    fn set_composition_visuals_on_demand(value: bool)
    

    Sets whether visuals get their composition visuals on demand. With false every visual has a composition visual from the moment it is attached to a visual tree, as upstream. It applies to the visuals attached from then on; it is meant to be set once, before the first window.

    Source

    child_composition_visual

    fn child_composition_visual(self: &Self) -> Option<Rc<CompositionVisual>>
    

    The composition visual shown as the last child of the composition visual of this visual (see ElementComposition).

    Source

    set_child_composition_visual

    fn set_child_composition_visual(self: &Self, value: Option<Rc<CompositionVisual>>)
    

    Source

    lights

    fn lights(self: &Self) -> FerroList<Ref<crate::media::XamlLight>>
    

    UIElement.Lights: the XAML lights the element holds. A light added to the collection is connected to the element (OnConnected) while the element is in a visual tree, and lights the targets of its id in the subtree of the element (winui-materials.md).

    Source

    has_lights

    fn has_lights(self: &Self) -> bool
    

    Whether the element holds a lights collection.

    Source

    light_target_ids

    fn light_target_ids(self: &Self) -> Vec<String>
    

    The ids of the XAML lights that target the element.

    Source

    translation

    fn translation(self: &Self) -> crate::Vector3D
    

    UIElement.Translation: the translation of the composition visual of the visual, applied after its render transform. Zero until set.

    As in WinUI the translation is not a styled property; setting it hands the Translation of the composition visual to this facade, which writes it whenever the visual is rendered again. While it was never set, the application may animate the Translation of the composition visual itself.

    Source

    set_translation

    fn set_translation(self: &Self, value: crate::Vector3D)
    

    Source

    is_hidden_by_composition

    fn is_hidden_by_composition(self: &Self) -> bool
    

    Whether the composition visual of the visual is hidden by requests of the composition API (see add_composition_hide_request).

    Source

    add_composition_hide_request

    fn add_composition_hide_request(self: &Self)
    

    Hides the composition visual of the visual until the matching remove_composition_hide_request, whatever IsVisible says. Requests are counted. A connected animation hides its source and destination this way while it shows them through visual surfaces, which render a hidden visual (WinUI hides the element's visual with SetConnectedAnimationRunning).

    Source

    remove_composition_hide_request

    fn remove_composition_hide_request(self: &Self)
    

    Ends a request of add_composition_hide_request.

    Source

    is_render_suppressed

    fn is_render_suppressed(self: &Self) -> bool
    

    Whether presentation owners have suppressed this visual and its descendants in all render paths. Suppression changes no styled property, layout or logical visibility. It also applies to immediate bitmap and visual-brush captures; composition-only hiding remains independently capturable for connected animations.

    Source

    add_render_suppression_request

    fn add_render_suppression_request(self: &Self)
    

    Suppresses drawing until a matching remove request. Independent owners may hold requests concurrently. Input behavior is deliberately separate: editors that suppress presentation may additionally install their own temporary hit-test policy.

    Source

    remove_render_suppression_request

    fn remove_render_suppression_request(self: &Self)
    

    Releases one request without changing another owner's suppression or authored values. Removing a request when none is active is harmless.

    Source

    is_shown_by_composition

    fn is_shown_by_composition(self: &Self) -> bool
    

    Whether the composition visual of the visual is kept visible by requests of the composition API although IsVisible is false (see add_composition_show_request).

    Source

    add_composition_show_request

    fn add_composition_show_request(self: &Self)
    

    Keeps the composition visual of the visual visible until the matching remove_composition_show_request, whatever IsVisible says. Requests are counted. An implicit hide animation keeps the element visible this way until it completes. A hide request wins over a show request.

    Source

    remove_composition_show_request

    fn remove_composition_show_request(self: &Self)
    

    Ends a request of add_composition_show_request.

    Source

    composition_layer_visual

    fn composition_layer_visual(self: &Self) -> Option<Rc<CompositionVisual>>
    

    A composition visual shown above the children of the visual and above its child composition visual (the layer of the connected animations of a top level, WinUI's ConnectedAnimationRoot).

    Source

    set_composition_layer_visual

    fn set_composition_layer_visual(self: &Self, value: Option<Rc<CompositionVisual>>)
    

    Sets the visual of composition_layer_visual.

    Source

    has_non_uniform_z_index_children

    fn has_non_uniform_z_index_children(self: &Self) -> bool
    

    Whether any child has a non-default Z index.

    Source

    is_attached_to_visual_tree

    fn is_attached_to_visual_tree(self: &Self) -> bool
    

    Whether this control is attached to a visual root.

    Source

    visual_parent

    fn visual_parent(self: &Self) -> Option<Ref<Visual>>
    

    The control's parent visual.

    Source

    invalidate_visual

    fn invalidate_visual(self: &Self)
    

    Invalidates the visual and queues a repaint.

    Source

    invalidate_composition_properties

    fn invalidate_composition_properties(self: &Self)
    

    Invalidates the composition properties of this visual (its render transform and opacity) but not its drawing: the renderer synchronizes the properties without calling render again. A FerroUI addition (docs/porting/desktop-performance.md, section 9.5): upstream invalidates the visual, which records its drawing again.

    Source

    affects_render

    fn affects_render<T: ObjectType + Upcast<Visual>>(properties: &[&'static FerroProperty])
    

    Indicates that a property change should cause invalidate_visual to be called on objects of class T.

    When the value of such a property is a media object that can change (a brush, pen, geometry, transform, effect or image), its invalidation invalidates the visual as well.

    Source

    Trait implementations

    Availability

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