Skip to content

ScrollPanelWidget

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

A scroll panel that provides scrolling capability for content that exceeds the available space. Only supports one direction at a time (vertical or horizontal).

csharp
public sealed record ScrollPanelWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<ScrollPanelWidget>

Inheritance

ObjectHex1bWidgetScrollPanelWidget

Implements

Constructors

ScrollPanelWidget(Hex1bWidget, ScrollOrientation, bool)

Creates a new ScrollPanelWidget.

Parameters:

  • child (Hex1bWidget): The child widget to scroll.
  • orientation (ScrollOrientation): The scroll orientation. Defaults to Vertical.
  • showScrollbar (Boolean): Whether to show the scrollbar. Defaults to true.
csharp
public ScrollPanelWidget(Hex1bWidget child, ScrollOrientation orientation = ScrollOrientation.Vertical, bool showScrollbar = true)

Properties

Child

The child widget to scroll.

Returns: Hex1bWidget

csharp
public Hex1bWidget Child { get; }

IsFollowing

When true, the scroll panel automatically follows the end of content. The panel scrolls to the bottom when content grows, and disengages when the user scrolls away. Re-engages when the user scrolls back to the end.

Returns: Boolean

csharp
public bool IsFollowing { get; init; }

Orientation

The scroll orientation (vertical or horizontal).

Returns: ScrollOrientation

csharp
public ScrollOrientation Orientation { get; init; }

ShowScrollbar

Whether to show the scrollbar when content is scrollable.

Returns: Boolean

csharp
public bool ShowScrollbar { get; init; }

Methods

Follow()

Enables follow mode: the scroll panel automatically scrolls to the end when content grows. Disengages when the user scrolls away, and re-engages when the user scrolls back to the end.

Returns: ScrollPanelWidget

A new ScrollPanelWidget with follow mode enabled.

csharp
public ScrollPanelWidget Follow()

OnScroll(Action<ScrollChangedEventArgs>)

Sets a synchronous scroll handler. Called when the scroll position changes.

Parameters:

Returns: ScrollPanelWidget

A new ScrollPanelWidget with the handler set.

csharp
public ScrollPanelWidget OnScroll(Action<ScrollChangedEventArgs> handler)

OnScroll(Func<ScrollChangedEventArgs, Task>)

Sets an asynchronous scroll handler. Called when the scroll position changes.

Parameters:

Returns: ScrollPanelWidget

A new ScrollPanelWidget with the handler set.

csharp
public ScrollPanelWidget OnScroll(Func<ScrollChangedEventArgs, Task> handler)

Fields

FocusFirstAction

Returns: ActionId

csharp
public static readonly ActionId FocusFirstAction

FocusNextAction

Returns: ActionId

csharp
public static readonly ActionId FocusNextAction

FocusPreviousAction

Returns: ActionId

csharp
public static readonly ActionId FocusPreviousAction

MouseScrollDownAction

Returns: ActionId

csharp
public static readonly ActionId MouseScrollDownAction

MouseScrollUpAction

Returns: ActionId

csharp
public static readonly ActionId MouseScrollUpAction

PageDownAction

Returns: ActionId

csharp
public static readonly ActionId PageDownAction

PageUpAction

Returns: ActionId

csharp
public static readonly ActionId PageUpAction

ScrollDownAction

Returns: ActionId

csharp
public static readonly ActionId ScrollDownAction

ScrollLeftAction

Returns: ActionId

csharp
public static readonly ActionId ScrollLeftAction

ScrollRightAction

Returns: ActionId

csharp
public static readonly ActionId ScrollRightAction

ScrollToEndAction

Returns: ActionId

csharp
public static readonly ActionId ScrollToEndAction

ScrollToStartAction

Returns: ActionId

csharp
public static readonly ActionId ScrollToStartAction

ScrollUpAction

Returns: ActionId

csharp
public static readonly ActionId ScrollUpAction

Released under the MIT License.