Table of Contents

Class ScrollBar

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Indicates the size of scrollable content and controls the position of the visible content, either vertically or horizontally. Two Buttons are provided, one to scroll up or left and one to scroll down or right. Between the buttons is a ScrollSlider that can be dragged to control the position of the visible content. The ScrollSlier is sized to show the proportion of the scrollable content to the size of the Viewport.

public class ScrollBar : View, IDisposable, ISupportInitializeNotification, ISupportInitialize, IOrientation, IDesignable
Inheritance
ScrollBar
Implements
Inherited Members

Remarks

See the Scrolling Deep Dive.

By default, the built-in View scrollbars (VerticalScrollBar/ HorizontalScrollBar) have both Visible and AutoShow set to false. To enable them, either set AutoShow set to true or explicitly set Visible to true.

By default, this view cannot be focused and does not support keyboard input.

Constructors

ScrollBar()

Initializes a new instance of View.

Properties

AutoShow

Gets or sets whether Visible will be set to true if the dimension of the scroll bar is less than ScrollableContentSize and false if greater than or equal to.

Increment

Gets or sets the amount each mouse wheel event, or click on the increment/decrement buttons, will incremenet/decrement the Position.

Orientation

Gets or sets the orientation of the View.

Position

Gets or sets the position of the slider relative to ScrollableContentSize.

ScrollableContentSize

Gets or sets the size of the content that can be scrolled. This is typically set to GetContentSize().

VisibleContentSize

Gets or sets the size of the visible viewport into the content being scrolled, bounded by ScrollableContentSize.

Methods

EnableForDesign()

Causes the View to enable design-time mode. This typically means that the view will load demo data and be configured to allow for design-time manipulation.

GetSliderPosition()

Gets or sets the position of the start of the Scroll slider, within the Viewport.

OnClearingViewport()

Called when the Viewport is to be cleared.

OnFrameChanged(in Rectangle)

Called when Frame changes.

OnMouseClick(MouseEventArgs)

Called when a mouse click occurs. Check Flags to see which button was clicked.

OnMouseEvent(MouseEventArgs)

Called when a mouse event occurs within the view's Viewport.

OnOrientationChanged(Orientation)

Called when Orientation has been changed.

OnPositionChanged(int)

Called when Position has changed.

OnPositionChanging(int, int)

Called when Position is changing. Return true to cancel the change.

OnScrolled(int)

Called when Position has changed. Indicates how much to scroll.

OnSizeChanged(int)

Called when ScrollableContentSize has changed.

OnSliderPositionChanged(int)

Called when the slider position has changed.

Events

OrientationChanged

Raised when Orientation has changed.

OrientationChanging

Raised when Orientation is changing. Can be cancelled.

PositionChanged

Raised when the Position has changed.

PositionChanging

Raised when the Position is changing. Set Cancel to true to prevent the position from being changed.

ScrollableContentSizeChanged

Raised when ScrollableContentSize has changed.

Scrolled

Raised when the Position has changed. Indicates how much to scroll.

SliderPositionChanged

Raised when the slider position has changed.