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
handlerEventHandler<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
handlerEventHandler<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
visibleboolTrue if visible.
Returns
- ScrollbarBuilder
The builder for chaining.
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment.
public ScrollbarBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignmentThe alignment.
Returns
- ScrollbarBuilder
The builder for chaining.
WithEnabled(bool)
Sets whether the bar is enabled.
public ScrollbarBuilder WithEnabled(bool enabled = true)
Parameters
enabledboolTrue if enabled.
Returns
- ScrollbarBuilder
The builder for chaining.
WithHeight(int)
Sets the height.
public ScrollbarBuilder WithHeight(int height)
Parameters
heightintThe 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
isActiveboolTrue 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
largeChangeintThe large-change amount.
Returns
- ScrollbarBuilder
The builder for chaining.
WithMargin(Margin)
Sets the margin.
public ScrollbarBuilder WithMargin(Margin margin)
Parameters
marginMarginThe margin.
Returns
- ScrollbarBuilder
The builder for chaining.
WithMargin(int)
Sets uniform margin on all sides.
public ScrollbarBuilder WithMargin(int margin)
Parameters
marginintThe 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
Returns
- ScrollbarBuilder
The builder for chaining.
WithMaximum(int)
Sets the total length of the content being scrolled.
public ScrollbarBuilder WithMaximum(int maximum)
Parameters
maximumintThe content length.
Returns
- ScrollbarBuilder
The builder for chaining.
WithName(string)
Sets the control name for FindControl queries.
public ScrollbarBuilder WithName(string name)
Parameters
namestringThe control name.
Returns
- ScrollbarBuilder
The builder for chaining.
WithOrientation(ScrollbarOrientation)
Sets the bar's orientation.
public ScrollbarBuilder WithOrientation(ScrollbarOrientation orientation)
Parameters
orientationScrollbarOrientationVertical 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
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
smallChangeintThe small-change amount.
Returns
- ScrollbarBuilder
The builder for chaining.
WithStickyPosition(StickyPosition)
Sets the sticky position.
public ScrollbarBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPositionThe sticky position.
Returns
- ScrollbarBuilder
The builder for chaining.
WithTag(object)
Sets the control tag for custom data storage.
public ScrollbarBuilder WithTag(object tag)
Parameters
tagobjectThe tag object.
Returns
- ScrollbarBuilder
The builder for chaining.
WithValue(int)
Sets the initial scroll offset.
public ScrollbarBuilder WithValue(int value)
Parameters
valueintThe initial offset.
Returns
- ScrollbarBuilder
The builder for chaining.
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment.
public ScrollbarBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignmentThe 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
viewportLengthintThe viewport length.
Returns
- ScrollbarBuilder
The builder for chaining.
WithWidth(int)
Sets the width.
public ScrollbarBuilder WithWidth(int width)
Parameters
widthintThe width.
Returns
- ScrollbarBuilder
The builder for chaining.
Operators
implicit operator ScrollbarControl(ScrollbarBuilder)
Implicit conversion to ScrollbarControl.
public static implicit operator ScrollbarControl(ScrollbarBuilder builder)
Parameters
builderScrollbarBuilderThe builder.