FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ParallaxBehavior

    struct · ferroui-xaml-interactions-custom · v0.5.0

    struct ParallaxBehavior
    

    A behavior that moves the associated element at a different speed than the scrolling container, creating a parallax effect.

    Deviation (DEVIATIONS.md, Behaviors): the reference implements IObserver<Vector> and subscribes itself to the offset of the scroll viewer; here the subscription is a closure that calls on_next, and on_error and on_completed are plain members (the class does not implement the observer contract, an object of the class model is not shared as an Rc).

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

    Returns a strong reference to this object.

    Source

    source_scroll_viewer_property

    fn source_scroll_viewer_property() -> &'static StyledProperty<Option<ElementRef<ScrollViewer>>>
    

    Identifies the SourceScrollViewer property.

    Deviation (DEVIATIONS.md, Behaviors): the behavior does not own the scroll viewer, so the value is an element reference.

    Source

    parallax_ratio_property

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

    Identifies the ParallaxRatio property.

    Source

    construct

    fn construct() -> Self
    

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

    Source

    new

    fn new() -> Ref<Self>
    

    Creates a behavior.

    Source

    source_scroll_viewer

    fn source_scroll_viewer(self: &Self) -> Option<Ref<ScrollViewer>>
    

    Gets or sets the source scroll viewer. If not set, the behavior will attempt to find a parent scroll viewer. Markup resolves a name given for it to the named element.

    Source

    set_source_scroll_viewer

    fn set_source_scroll_viewer(self: &Self, value: impl Into<Nullable<ScrollViewer>>)
    

    Source

    parallax_ratio

    fn parallax_ratio(self: &Self) -> f64
    

    Gets or sets the parallax ratio. 0.0 means no movement (static). 1.0 means moves with scroll (normal). Values between 0 and 1 create a "far away" depth effect. Negative values move in reverse.

    Source

    set_parallax_ratio

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

    Source

    on_completed

    fn on_completed(self: &Self)
    

    Notifies the behavior that the offset observable completed (IObserver.OnCompleted).

    Source

    on_error

    fn on_error(self: &Self, _error: ObservableError)
    

    Notifies the behavior that the offset observable failed (IObserver.OnError).

    Source

    on_next

    fn on_next(self: &Self, value: Vector)
    

    Applies the parallax offset for the scroll offset value (IObserver.OnNext).

    Source

    Trait implementations

    Availability

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