Table of Contents

Class ScrollBar

Namespace
Terminal.Gui.Views
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, IValue<int>, IValue
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 Value.

Orientation

Gets or sets the orientation of the View.

ScrollableContentSize

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

Value

Gets or sets the scroll position relative to ScrollableContentSize.

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.

OnActivating(CommandEventArgs)

Called when the user has performed an action (e.g. Activate) causing the View to change state or preparing it for interaction. Set CommandEventArgs.Handled to true and return true to indicate the event was handled and processing should stop.

OnClearingViewport()

Called when the Viewport is to be cleared.

OnFrameChanged(in Rectangle)

Called when Frame changes.

OnMouseEvent(Mouse)

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

OnOrientationChanged(Orientation)

Called when Orientation has been changed.

OnScrolled(int)

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

OnSizeChanged(int)

Called when ScrollableContentSize has changed.

OnSliderPositionChanged(int)

Called when the slider position has changed.

OnValueChanged(ValueChangedEventArgs<int>)

Called when Value has changed.

OnValueChanging(ValueChangingEventArgs<int>)

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

Events

OrientationChanged

Raised when Orientation has changed.

OrientationChanging

Raised when Orientation is changing. Can be cancelled.

ScrollableContentSizeChanged

Raised when ScrollableContentSize has changed.

Scrolled

Raised when the Value has changed. Indicates how much was scrolled.

SliderPositionChanged

Raised when the slider position has changed.

ValueChanged

Raised when Value has changed.

ValueChanging

Raised when Value is about to change. Set Handled to true to cancel the change.