Table of Contents

Class ScrollbarBuilder

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for standalone ScrollbarControl instances.

public sealed class ScrollbarBuilder : IControlBuilder<ScrollbarControl>
Inheritance
ScrollbarBuilder
Implements
Inherited Members
Extension Methods

Methods

Build()

Builds the scrollbar control.

public ScrollbarControl Build()

Returns

ScrollbarControl

The configured control.

Horizontal()

Sets the bar to run horizontally.

public ScrollbarBuilder Horizontal()

Returns

ScrollbarBuilder

The builder for chaining.

OnUserValueChanged(EventHandler<int>)

Attaches a handler for the UserValueChanged event, raised only for changes made through the bar itself.

public ScrollbarBuilder OnUserValueChanged(EventHandler<int> handler)

Parameters

handler EventHandler<int>

The event handler.

Returns

ScrollbarBuilder

The builder for chaining.

OnValueChanged(EventHandler<int>)

Attaches a handler for the ValueChanged event, raised on every value change including a code-set one.

public ScrollbarBuilder OnValueChanged(EventHandler<int> handler)

Parameters

handler EventHandler<int>

The event handler.

Returns

ScrollbarBuilder

The builder for chaining.

Vertical()

Sets the bar to run vertically (the default).

public ScrollbarBuilder Vertical()

Returns

ScrollbarBuilder

The builder for chaining.

Visible(bool)

Sets the visibility.

public ScrollbarBuilder Visible(bool visible = true)

Parameters

visible bool

True if visible.

Returns

ScrollbarBuilder

The builder for chaining.

WithAlignment(HorizontalAlignment)

Sets the horizontal alignment.

public ScrollbarBuilder WithAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

The alignment.

Returns

ScrollbarBuilder

The builder for chaining.

WithEnabled(bool)

Sets whether the bar is enabled.

public ScrollbarBuilder WithEnabled(bool enabled = true)

Parameters

enabled bool

True if enabled.

Returns

ScrollbarBuilder

The builder for chaining.

WithHeight(int)

Sets the height.

public ScrollbarBuilder WithHeight(int height)

Parameters

height int

The height.

Returns

ScrollbarBuilder

The builder for chaining.

WithIsActive(bool)

Sets whether the bar paints itself as focused while a sibling view actually holds focus.

public ScrollbarBuilder WithIsActive(bool isActive = true)

Parameters

isActive bool

True to paint as focused.

Returns

ScrollbarBuilder

The builder for chaining.

WithLargeChange(int)

Sets the amount Value moves for a track (page) click. Defaults to the viewport length when not set.

public ScrollbarBuilder WithLargeChange(int largeChange)

Parameters

largeChange int

The large-change amount.

Returns

ScrollbarBuilder

The builder for chaining.

WithMargin(Margin)

Sets the margin.

public ScrollbarBuilder WithMargin(Margin margin)

Parameters

margin Margin

The margin.

Returns

ScrollbarBuilder

The builder for chaining.

WithMargin(int)

Sets uniform margin on all sides.

public ScrollbarBuilder WithMargin(int margin)

Parameters

margin int

The margin value.

Returns

ScrollbarBuilder

The builder for chaining.

WithMargin(int, int, int, int)

Sets the margin.

public ScrollbarBuilder WithMargin(int left, int top, int right, int bottom)

Parameters

left int

Left margin.

top int

Top margin.

right int

Right margin.

bottom int

Bottom margin.

Returns

ScrollbarBuilder

The builder for chaining.

WithMaximum(int)

Sets the total length of the content being scrolled.

public ScrollbarBuilder WithMaximum(int maximum)

Parameters

maximum int

The content length.

Returns

ScrollbarBuilder

The builder for chaining.

WithName(string)

Sets the control name for FindControl queries.

public ScrollbarBuilder WithName(string name)

Parameters

name string

The control name.

Returns

ScrollbarBuilder

The builder for chaining.

WithOrientation(ScrollbarOrientation)

Sets the bar's orientation.

public ScrollbarBuilder WithOrientation(ScrollbarOrientation orientation)

Parameters

orientation ScrollbarOrientation

Vertical or horizontal.

Returns

ScrollbarBuilder

The builder for chaining.

WithScrollbarColors(Color, Color)

Sets the track and thumb colors. When not called, the bar uses the built-in focus-aware default colors.

public ScrollbarBuilder WithScrollbarColors(Color trackColor, Color thumbColor)

Parameters

trackColor Color

The track color.

thumbColor Color

The thumb color.

Returns

ScrollbarBuilder

The builder for chaining.

WithSmallChange(int)

Sets the amount Value moves for an arrow click or wheel notch. Default: DefaultScrollWheelLines.

public ScrollbarBuilder WithSmallChange(int smallChange)

Parameters

smallChange int

The small-change amount.

Returns

ScrollbarBuilder

The builder for chaining.

WithStickyPosition(StickyPosition)

Sets the sticky position.

public ScrollbarBuilder WithStickyPosition(StickyPosition position)

Parameters

position StickyPosition

The sticky position.

Returns

ScrollbarBuilder

The builder for chaining.

WithTag(object)

Sets the control tag for custom data storage.

public ScrollbarBuilder WithTag(object tag)

Parameters

tag object

The tag object.

Returns

ScrollbarBuilder

The builder for chaining.

WithValue(int)

Sets the initial scroll offset.

public ScrollbarBuilder WithValue(int value)

Parameters

value int

The initial offset.

Returns

ScrollbarBuilder

The builder for chaining.

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment.

public ScrollbarBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

The vertical alignment.

Returns

ScrollbarBuilder

The builder for chaining.

WithViewportLength(int)

Sets the visible length of the view the bar represents.

public ScrollbarBuilder WithViewportLength(int viewportLength)

Parameters

viewportLength int

The viewport length.

Returns

ScrollbarBuilder

The builder for chaining.

WithWidth(int)

Sets the width.

public ScrollbarBuilder WithWidth(int width)

Parameters

width int

The width.

Returns

ScrollbarBuilder

The builder for chaining.

Operators

implicit operator ScrollbarControl(ScrollbarBuilder)

Implicit conversion to ScrollbarControl.

public static implicit operator ScrollbarControl(ScrollbarBuilder builder)

Parameters

builder ScrollbarBuilder

The builder.

Returns

ScrollbarControl