ScrollViewer
struct · ferroui-controls · v0.5.0
struct ScrollViewer
A control which scrolls its content if the content is bigger than the space available.
Members
TYPEto_refon_scroll_changedTEMPLATE_PARTSbring_into_view_on_focus_change_propertyextent_propertyoffset_propertyzoom_mode_propertymin_zoom_factor_propertymax_zoom_factor_propertyzoom_factor_propertyviewport_propertylarge_change_propertysmall_change_propertyscroll_bar_maximum_propertyhorizontal_scroll_bar_visibility_propertyhorizontal_snap_points_type_propertyvertical_snap_points_type_propertyhorizontal_snap_points_alignment_propertyvertical_snap_points_alignment_propertyvertical_scroll_bar_visibility_propertyis_expanded_propertyallow_auto_hide_propertyis_scroll_chaining_enabled_propertyis_scroll_inertia_enabled_propertyis_deferred_scrolling_enabled_propertyscroll_changed_eventconstructnewscroll_changedbring_into_view_on_focus_changeset_bring_into_view_on_focus_changeextentoffsetset_offsetviewportzoom_modeset_zoom_modemin_zoom_factorset_min_zoom_factormax_zoom_factorset_max_zoom_factorzoom_factorchange_viewchange_view_withzoom_to_factorlarge_changesmall_changehorizontal_scroll_bar_visibilityset_horizontal_scroll_bar_visibilityvertical_scroll_bar_visibilityset_vertical_scroll_bar_visibilitycan_horizontally_scrollcan_vertically_scrollcurrent_anchorscroll_bar_maximumis_expandedhorizontal_snap_points_typeset_horizontal_snap_points_typevertical_snap_points_typeset_vertical_snap_points_typehorizontal_snap_points_alignmentset_horizontal_snap_points_alignmentvertical_snap_points_alignmentset_vertical_snap_points_alignmentallow_auto_hideset_allow_auto_hideis_scroll_chaining_enabledset_is_scroll_chaining_enabledis_scroll_inertia_enabledset_is_scroll_inertia_enabledis_deferred_scrolling_enabledset_is_deferred_scrolling_enabledline_upline_downline_leftline_rightpage_uppage_downpage_leftpage_rightscroll_to_homescroll_to_endget_bring_into_view_on_focus_changeset_bring_into_view_on_focus_change_onget_horizontal_scroll_bar_visibilityset_horizontal_scroll_bar_visibility_onget_horizontal_snap_points_typeset_horizontal_snap_points_type_onget_vertical_snap_points_typeset_vertical_snap_points_type_onget_horizontal_snap_points_alignmentset_horizontal_snap_points_alignment_onget_vertical_snap_points_alignmentset_vertical_snap_points_alignment_onget_vertical_scroll_bar_visibilityset_allow_auto_hide_onget_allow_auto_hideset_is_scroll_chaining_enabled_onget_is_scroll_chaining_enabledset_vertical_scroll_bar_visibility_onget_is_scroll_inertia_enabledset_is_scroll_inertia_enabled_onget_is_deferred_scrolling_enabledset_is_deferred_scrolling_enabled_onregister_anchor_candidateunregister_anchor_candidate
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<ScrollViewer>
Returns a strong reference to this object.
on_scroll_changed
fn on_scroll_changed(self: &Self, e: &ScrollChangedEventArgs)
Called when a change in scrolling state is detected, such as a change in scroll position, extent, or viewport size.
If you override this method, call the parent implementation to
ensure that the ScrollChanged event is raised.
TEMPLATE_PARTS
const TEMPLATE_PARTS: &'static [TemplatePartAttribute]
The named parts expected in the control template, in addition to those of the base class.
bring_into_view_on_focus_change_property
fn bring_into_view_on_focus_change_property() -> &'static AttachedProperty<bool>
Defines the BringIntoViewOnFocusChange property.
extent_property
fn extent_property() -> &'static DirectProperty<ScrollViewer, Size>
Defines the Extent property.
offset_property
fn offset_property() -> &'static StyledProperty<Vector>
Defines the Offset property.
zoom_mode_property
fn zoom_mode_property() -> &'static StyledProperty<ZoomMode>
Defines the ZoomMode property (WinUI ScrollViewer.ZoomMode, not upstream): whether
the user can zoom the content.
min_zoom_factor_property
fn min_zoom_factor_property() -> &'static StyledProperty<f32>
Defines the MinZoomFactor property (WinUI, not upstream).
max_zoom_factor_property
fn max_zoom_factor_property() -> &'static StyledProperty<f32>
Defines the MaxZoomFactor property (WinUI, not upstream).
zoom_factor_property
fn zoom_factor_property() -> &'static DirectProperty<ScrollViewer, f32>
Defines the ZoomFactor property (WinUI, not upstream): the zoom of the content,
changed with change_view or by the user.
viewport_property
fn viewport_property() -> &'static DirectProperty<ScrollViewer, Size>
Defines the Viewport property.
large_change_property
fn large_change_property() -> &'static DirectProperty<ScrollViewer, Size>
Defines the LargeChange property.
small_change_property
fn small_change_property() -> &'static DirectProperty<ScrollViewer, Size>
Defines the SmallChange property.
scroll_bar_maximum_property
fn scroll_bar_maximum_property() -> &'static DirectProperty<ScrollViewer, Vector>
Defines the ScrollBarMaximum property.
horizontal_scroll_bar_visibility_property
fn horizontal_scroll_bar_visibility_property() -> &'static AttachedProperty<ScrollBarVisibility>
Defines the HorizontalScrollBarVisibility property.
horizontal_snap_points_type_property
fn horizontal_snap_points_type_property() -> &'static AttachedProperty<SnapPointsType>
Defines the HorizontalSnapPointsType property.
vertical_snap_points_type_property
fn vertical_snap_points_type_property() -> &'static AttachedProperty<SnapPointsType>
Defines the VerticalSnapPointsType property.
horizontal_snap_points_alignment_property
fn horizontal_snap_points_alignment_property() -> &'static AttachedProperty<SnapPointsAlignment>
Defines the HorizontalSnapPointsAlignment property.
vertical_snap_points_alignment_property
fn vertical_snap_points_alignment_property() -> &'static AttachedProperty<SnapPointsAlignment>
Defines the VerticalSnapPointsAlignment property.
vertical_scroll_bar_visibility_property
fn vertical_scroll_bar_visibility_property() -> &'static AttachedProperty<ScrollBarVisibility>
Defines the VerticalScrollBarVisibility property.
is_expanded_property
fn is_expanded_property() -> &'static DirectProperty<ScrollViewer, bool>
Defines the IsExpanded property.
allow_auto_hide_property
fn allow_auto_hide_property() -> &'static AttachedProperty<bool>
Defines the AllowAutoHide property.
is_scroll_chaining_enabled_property
fn is_scroll_chaining_enabled_property() -> &'static AttachedProperty<bool>
Defines the IsScrollChainingEnabled property.
is_scroll_inertia_enabled_property
fn is_scroll_inertia_enabled_property() -> &'static AttachedProperty<bool>
Defines the IsScrollInertiaEnabled property.
is_deferred_scrolling_enabled_property
fn is_deferred_scrolling_enabled_property() -> &'static AttachedProperty<bool>
Defines the IsDeferredScrollingEnabled property.
scroll_changed_event
fn scroll_changed_event() -> &'static RoutedEvent<ScrollChangedEventArgs>
Defines the ScrollChanged event.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
Initializes a new instance of the class.
scroll_changed
fn scroll_changed(self: &Self, handler: impl Fn(&Interactive, &ScrollChangedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Occurs when changes are detected to the scroll position, extent, or viewport size.
bring_into_view_on_focus_change
fn bring_into_view_on_focus_change(self: &Self) -> bool
Gets a value that determines whether the scroll viewer uses a bring-into-view scroll behavior when an item in the view gets focus.
True to use a behavior that brings focused items into view. False to use a behavior that focused items do not automatically scroll into view. The default is true.
The value can either be set explicitly on a scroll viewer, or the
attached ScrollViewer.BringIntoViewOnFocusChange property can be
set on an element that hosts a scroll viewer.
set_bring_into_view_on_focus_change
fn set_bring_into_view_on_focus_change(self: &Self, value: bool)
Sets a value that determines whether the scroll viewer uses a bring-into-view scroll behavior when an item in the view gets focus.
extent
fn extent(self: &Self) -> Size
Gets the extent of the scrollable content.
offset
fn offset(self: &Self) -> Vector
Gets the current scroll offset.
set_offset
fn set_offset(self: &Self, value: Vector)
Sets the current scroll offset.
viewport
fn viewport(self: &Self) -> Size
Gets the size of the viewport on the scrollable content.
zoom_mode
fn zoom_mode(self: &Self) -> ZoomMode
ZoomMode: whether the user can zoom the content (Ctrl and the mouse wheel); a zoom
asked for by change_view is applied either way.
set_zoom_mode
fn set_zoom_mode(self: &Self, value: ZoomMode)
min_zoom_factor
fn min_zoom_factor(self: &Self) -> f32
MinZoomFactor (default 0.1).
set_min_zoom_factor
fn set_min_zoom_factor(self: &Self, value: f32)
max_zoom_factor
fn max_zoom_factor(self: &Self) -> f32
MaxZoomFactor (default 10).
set_max_zoom_factor
fn set_max_zoom_factor(self: &Self, value: f32)
zoom_factor
fn zoom_factor(self: &Self) -> f32
ZoomFactor: the zoom of the content (1 unless it was zoomed). The content keeps its
layout and is scaled about its top left corner; the extent and the offsets are in
zoomed units, as in WinUI.
change_view
fn change_view(self: &Self, horizontal_offset: Option<f64>, vertical_offset: Option<f64>, zoom_factor: Option<f32>) -> bool
ChangeView(horizontalOffset, verticalOffset, zoomFactor): scrolls and zooms the content
to the values given (None keeps the current one); the zoom factor is kept between the
minimum and the maximum, the offsets within the extent at that zoom. Returns false when
the scroll viewer has no scroll presenter to change.
Deviation (winui-composition.md): the change is applied at once; WinUI animates it unless
disableAnimation (see change_view_with).
change_view_with
fn change_view_with(self: &Self, horizontal_offset: Option<f64>, vertical_offset: Option<f64>, zoom_factor: Option<f32>, _disable_animation: bool) -> bool
ChangeView(horizontalOffset, verticalOffset, zoomFactor, disableAnimation).
zoom_to_factor
fn zoom_to_factor(self: &Self, factor: f32)
ZoomToFactor(factor) (deprecated in WinUI for ChangeView): zooms to factor, keeping
the offsets.
large_change
fn large_change(self: &Self) -> Size
Gets the large (page) change value for the scroll viewer.
small_change
fn small_change(self: &Self) -> Size
Gets the small (line) change value for the scroll viewer.
horizontal_scroll_bar_visibility
fn horizontal_scroll_bar_visibility(self: &Self) -> ScrollBarVisibility
Gets the horizontal scrollbar visibility.
set_horizontal_scroll_bar_visibility
fn set_horizontal_scroll_bar_visibility(self: &Self, value: ScrollBarVisibility)
Sets the horizontal scrollbar visibility.
vertical_scroll_bar_visibility
fn vertical_scroll_bar_visibility(self: &Self) -> ScrollBarVisibility
Gets the vertical scrollbar visibility.
set_vertical_scroll_bar_visibility
fn set_vertical_scroll_bar_visibility(self: &Self, value: ScrollBarVisibility)
Sets the vertical scrollbar visibility.
can_horizontally_scroll
fn can_horizontally_scroll(self: &Self) -> bool
Gets a value indicating whether the viewer can scroll horizontally.
can_vertically_scroll
fn can_vertically_scroll(self: &Self) -> bool
Gets a value indicating whether the viewer can scroll vertically.
current_anchor
fn current_anchor(self: &Self) -> Option<Ref<Control>>
The currently chosen anchor element to use for scroll anchoring.
scroll_bar_maximum
fn scroll_bar_maximum(self: &Self) -> Vector
Gets the maximum scrolling distance (which is the extent minus the viewport).
is_expanded
fn is_expanded(self: &Self) -> bool
Gets a value that indicates whether any scrollbar is expanded.
horizontal_snap_points_type
fn horizontal_snap_points_type(self: &Self) -> SnapPointsType
Gets how scroll gesture reacts to the snap points along the horizontal axis.
set_horizontal_snap_points_type
fn set_horizontal_snap_points_type(self: &Self, value: SnapPointsType)
Sets how scroll gesture reacts to the snap points along the horizontal axis.
vertical_snap_points_type
fn vertical_snap_points_type(self: &Self) -> SnapPointsType
Gets how scroll gesture reacts to the snap points along the vertical axis.
set_vertical_snap_points_type
fn set_vertical_snap_points_type(self: &Self, value: SnapPointsType)
Sets how scroll gesture reacts to the snap points along the vertical axis.
horizontal_snap_points_alignment
fn horizontal_snap_points_alignment(self: &Self) -> SnapPointsAlignment
Gets how the existing snap points are horizontally aligned versus the initial viewport.
set_horizontal_snap_points_alignment
fn set_horizontal_snap_points_alignment(self: &Self, value: SnapPointsAlignment)
Sets how the existing snap points are horizontally aligned versus the initial viewport.
vertical_snap_points_alignment
fn vertical_snap_points_alignment(self: &Self) -> SnapPointsAlignment
Gets how the existing snap points are vertically aligned versus the initial viewport.
set_vertical_snap_points_alignment
fn set_vertical_snap_points_alignment(self: &Self, value: SnapPointsAlignment)
Sets how the existing snap points are vertically aligned versus the initial viewport.
allow_auto_hide
fn allow_auto_hide(self: &Self) -> bool
Gets a value that indicates whether scrollbars can hide itself when user is not interacting with it.
set_allow_auto_hide
fn set_allow_auto_hide(self: &Self, value: bool)
Sets a value that indicates whether scrollbars can hide itself when user is not interacting with it.
is_scroll_chaining_enabled
fn is_scroll_chaining_enabled(self: &Self) -> bool
Gets if scroll chaining is enabled. The default value is true.
After a user hits a scroll limit on an element that has been nested within another scrollable element, you can specify whether that parent element should continue the scrolling operation begun in its child element. This is called scroll chaining.
set_is_scroll_chaining_enabled
fn set_is_scroll_chaining_enabled(self: &Self, value: bool)
Sets if scroll chaining is enabled.
is_scroll_inertia_enabled
fn is_scroll_inertia_enabled(self: &Self) -> bool
Gets whether scroll gestures should include inertia in their behavior and value.
set_is_scroll_inertia_enabled
fn set_is_scroll_inertia_enabled(self: &Self, value: bool)
Sets whether scroll gestures should include inertia in their behavior and value.
is_deferred_scrolling_enabled
fn is_deferred_scrolling_enabled(self: &Self) -> bool
Gets whether dragging of thumb elements should update the scroll viewer only when the user releases the mouse.
set_is_deferred_scrolling_enabled
fn set_is_deferred_scrolling_enabled(self: &Self, value: bool)
Sets whether dragging of thumb elements should update the scroll viewer only when the user releases the mouse.
line_up
fn line_up(self: &Self)
Scrolls the content up one line.
line_down
fn line_down(self: &Self)
Scrolls the content down one line.
line_left
fn line_left(self: &Self)
Scrolls the content left one line.
line_right
fn line_right(self: &Self)
Scrolls the content right one line.
page_up
fn page_up(self: &Self)
Scrolls the content upward by one page.
page_down
fn page_down(self: &Self)
Scrolls the content downward by one page.
page_left
fn page_left(self: &Self)
Scrolls the content left by one page.
page_right
fn page_right(self: &Self)
Scrolls the content right by one page.
scroll_to_home
fn scroll_to_home(self: &Self)
Scrolls to the top-left corner of the content.
scroll_to_end
fn scroll_to_end(self: &Self)
Scrolls to the bottom-left corner of the content.
get_bring_into_view_on_focus_change
fn get_bring_into_view_on_focus_change(control: &Control) -> bool
Gets the value of the BringIntoViewOnFocusChange attached property
of control.
set_bring_into_view_on_focus_change_on
fn set_bring_into_view_on_focus_change_on(control: &Control, value: bool)
Sets the value of the BringIntoViewOnFocusChange attached property
on control.
get_horizontal_scroll_bar_visibility
fn get_horizontal_scroll_bar_visibility(control: &Control) -> ScrollBarVisibility
Gets the value of the HorizontalScrollBarVisibility attached
property of control.
set_horizontal_scroll_bar_visibility_on
fn set_horizontal_scroll_bar_visibility_on(control: &Control, value: ScrollBarVisibility)
Sets the value of the HorizontalScrollBarVisibility attached
property on control.
get_horizontal_snap_points_type
fn get_horizontal_snap_points_type(control: &Control) -> SnapPointsType
Gets the value of the HorizontalSnapPointsType attached property of
control.
set_horizontal_snap_points_type_on
fn set_horizontal_snap_points_type_on(control: &Control, value: SnapPointsType)
Sets the value of the HorizontalSnapPointsType attached property on
control.
get_vertical_snap_points_type
fn get_vertical_snap_points_type(control: &Control) -> SnapPointsType
Gets the value of the VerticalSnapPointsType attached property of
control.
set_vertical_snap_points_type_on
fn set_vertical_snap_points_type_on(control: &Control, value: SnapPointsType)
Sets the value of the VerticalSnapPointsType attached property on
control.
get_horizontal_snap_points_alignment
fn get_horizontal_snap_points_alignment(control: &Control) -> SnapPointsAlignment
Gets the value of the HorizontalSnapPointsAlignment attached
property of control.
set_horizontal_snap_points_alignment_on
fn set_horizontal_snap_points_alignment_on(control: &Control, value: SnapPointsAlignment)
Sets the value of the HorizontalSnapPointsAlignment attached
property on control.
get_vertical_snap_points_alignment
fn get_vertical_snap_points_alignment(control: &Control) -> SnapPointsAlignment
Gets the value of the VerticalSnapPointsAlignment attached property
of control.
set_vertical_snap_points_alignment_on
fn set_vertical_snap_points_alignment_on(control: &Control, value: SnapPointsAlignment)
Sets the value of the VerticalSnapPointsAlignment attached property
on control.
get_vertical_scroll_bar_visibility
fn get_vertical_scroll_bar_visibility(control: &Control) -> ScrollBarVisibility
Gets the value of the VerticalScrollBarVisibility attached property
of control.
set_allow_auto_hide_on
fn set_allow_auto_hide_on(control: &Control, value: bool)
Sets the value of the AllowAutoHide attached property on control.
get_allow_auto_hide
fn get_allow_auto_hide(control: &Control) -> bool
Gets the value of the AllowAutoHide attached property of control.
set_is_scroll_chaining_enabled_on
fn set_is_scroll_chaining_enabled_on(control: &Control, value: bool)
Sets the value of the IsScrollChainingEnabled attached property on
control.
After a user hits a scroll limit on an element that has been nested within another scrollable element, you can specify whether that parent element should continue the scrolling operation begun in its child element. This is called scroll chaining.
get_is_scroll_chaining_enabled
fn get_is_scroll_chaining_enabled(control: &Control) -> bool
Gets the value of the IsScrollChainingEnabled attached property of
control.
After a user hits a scroll limit on an element that has been nested within another scrollable element, you can specify whether that parent element should continue the scrolling operation begun in its child element. This is called scroll chaining.
set_vertical_scroll_bar_visibility_on
fn set_vertical_scroll_bar_visibility_on(control: &Control, value: ScrollBarVisibility)
Sets the value of the VerticalScrollBarVisibility attached property
on control.
get_is_scroll_inertia_enabled
fn get_is_scroll_inertia_enabled(control: &Control) -> bool
Gets whether scroll gestures should include inertia in their behavior and value.
set_is_scroll_inertia_enabled_on
fn set_is_scroll_inertia_enabled_on(control: &Control, value: bool)
Sets whether scroll gestures should include inertia in their behavior and value.
get_is_deferred_scrolling_enabled
fn get_is_deferred_scrolling_enabled(control: &Control) -> bool
Gets whether dragging of thumb elements should update the scroll viewer only when the user releases the mouse.
set_is_deferred_scrolling_enabled_on
fn set_is_deferred_scrolling_enabled_on(control: &Control, value: bool)
Sets whether dragging of thumb elements should update the scroll viewer only when the user releases the mouse.
register_anchor_candidate
fn register_anchor_candidate(self: &Self, element: &Ref<Control>)
Registers a control as a potential scroll anchor candidate.
unregister_anchor_candidate
fn unregister_anchor_candidate(self: &Self, element: &Ref<Control>)
Unregisters a control as a potential scroll anchor candidate.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTemplatedControlImplExtContentControlImplExtControlImplExtScrollViewerImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<ScrollViewer>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleStyledElementImplVisualImplLayoutableImplInteractiveImplControlImplFerroObjectImplInputElementImplTemplatedControlImplContentControlImplScrollViewerImplIScrollableIScrollAnchorProvider
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.