Class ScrollablePanelBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for scrollable panel controls
public sealed class ScrollablePanelBuilder : IControlBuilder<ScrollablePanelControl>
- Inheritance
-
ScrollablePanelBuilder
- Implements
- Inherited Members
- Extension Methods
Methods
AddControl(IWindowControl)
Adds a child control to the panel
public ScrollablePanelBuilder AddControl(IWindowControl control)
Parameters
controlIWindowControlThe control to add
Returns
- ScrollablePanelBuilder
The builder for chaining
Build()
Builds the scrollable panel control
public ScrollablePanelControl Build()
Returns
- ScrollablePanelControl
The configured control
OnGotFocus(EventHandler)
Attaches a handler for the GotFocus event
public ScrollablePanelBuilder OnGotFocus(EventHandler handler)
Parameters
handlerEventHandlerThe event handler
Returns
- ScrollablePanelBuilder
The builder for chaining
OnLostFocus(EventHandler)
Attaches a handler for the LostFocus event
public ScrollablePanelBuilder OnLostFocus(EventHandler handler)
Parameters
handlerEventHandlerThe event handler
Returns
- ScrollablePanelBuilder
The builder for chaining
OnScrolled(EventHandler<ScrollEventArgs>)
Attaches a handler for the Scrolled event
public ScrollablePanelBuilder OnScrolled(EventHandler<ScrollEventArgs> handler)
Parameters
handlerEventHandler<ScrollEventArgs>The event handler
Returns
- ScrollablePanelBuilder
The builder for chaining
Rounded()
Sets rounded border style
public ScrollablePanelBuilder Rounded()
Returns
ScrollbarLeft()
Sets the scrollbar position to left
public ScrollablePanelBuilder ScrollbarLeft()
Returns
- ScrollablePanelBuilder
The builder for chaining
ScrollbarRight()
Sets the scrollbar position to right
public ScrollablePanelBuilder ScrollbarRight()
Returns
- ScrollablePanelBuilder
The builder for chaining
SingleBorder()
Sets single-line border style
public ScrollablePanelBuilder SingleBorder()
Returns
StickyBottom()
Makes the control stick to the bottom of the window
public ScrollablePanelBuilder StickyBottom()
Returns
- ScrollablePanelBuilder
The builder for chaining
StickyTop()
Makes the control stick to the top of the window
public ScrollablePanelBuilder StickyTop()
Returns
- ScrollablePanelBuilder
The builder for chaining
Visible(bool)
Sets the visibility
public ScrollablePanelBuilder Visible(bool visible = true)
Parameters
visibleboolTrue if visible
Returns
- ScrollablePanelBuilder
The builder for chaining
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment
public ScrollablePanelBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignmentThe alignment
Returns
- ScrollablePanelBuilder
The builder for chaining
WithAutoScroll(bool)
Enables or disables automatic scrolling to bottom when content is added. When enabled, new content auto-scrolls to bottom if already at bottom, disables when user scrolls up, and re-enables when user scrolls to bottom.
public ScrollablePanelBuilder WithAutoScroll(bool enabled = true)
Parameters
enabledboolTrue to enable auto-scroll
Returns
- ScrollablePanelBuilder
The builder for chaining
WithBackgroundColor(Color)
Sets the background color
public ScrollablePanelBuilder WithBackgroundColor(Color color)
Parameters
colorColorThe background color
Returns
- ScrollablePanelBuilder
The builder for chaining
WithBorderColor(Color)
Sets the border color
public ScrollablePanelBuilder WithBorderColor(Color color)
Parameters
colorColor
Returns
WithBorderStyle(BorderStyle)
Sets the border style
public ScrollablePanelBuilder WithBorderStyle(BorderStyle style)
Parameters
styleBorderStyle
Returns
WithColors(Color, Color)
Sets both foreground and background colors
public ScrollablePanelBuilder WithColors(Color foreground, Color background)
Parameters
Returns
- ScrollablePanelBuilder
The builder for chaining
WithForegroundColor(Color)
Sets the foreground color
public ScrollablePanelBuilder WithForegroundColor(Color color)
Parameters
colorColorThe foreground color
Returns
- ScrollablePanelBuilder
The builder for chaining
WithHeader(string)
Sets the header text for the top border
public ScrollablePanelBuilder WithHeader(string header)
Parameters
headerstring
Returns
WithHeaderAlignment(TextJustification)
Sets the header text alignment
public ScrollablePanelBuilder WithHeaderAlignment(TextJustification alignment)
Parameters
alignmentTextJustification
Returns
WithHeight(int)
Sets the height
public ScrollablePanelBuilder WithHeight(int height)
Parameters
heightintThe height
Returns
- ScrollablePanelBuilder
The builder for chaining
WithHorizontalScroll(ScrollMode)
Sets the horizontal scroll mode
public ScrollablePanelBuilder WithHorizontalScroll(ScrollMode mode = ScrollMode.Scroll)
Parameters
modeScrollModeThe scroll mode (None, Scroll, or Wrap)
Returns
- ScrollablePanelBuilder
The builder for chaining
WithMargin(Margin)
Sets the margin
public ScrollablePanelBuilder WithMargin(Margin margin)
Parameters
marginMarginThe margin
Returns
- ScrollablePanelBuilder
The builder for chaining
WithMargin(int)
Sets uniform margin on all sides
public ScrollablePanelBuilder WithMargin(int margin)
Parameters
marginintThe margin value
Returns
- ScrollablePanelBuilder
The builder for chaining
WithMargin(int, int, int, int)
Sets the margin
public ScrollablePanelBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
- ScrollablePanelBuilder
The builder for chaining
WithMouseWheel(bool)
Sets whether mouse wheel scrolling is enabled
public ScrollablePanelBuilder WithMouseWheel(bool enable = true)
Parameters
enableboolTrue to enable mouse wheel scrolling
Returns
- ScrollablePanelBuilder
The builder for chaining
WithName(string)
Sets the control name for FindControl queries
public ScrollablePanelBuilder WithName(string name)
Parameters
namestringThe control name
Returns
- ScrollablePanelBuilder
The builder for chaining
WithPadding(Padding)
Sets the padding inside the border
public ScrollablePanelBuilder WithPadding(Padding padding)
Parameters
paddingPadding
Returns
WithPadding(int, int, int, int)
Sets the padding inside the border
public ScrollablePanelBuilder WithPadding(int left, int top, int right, int bottom)
Parameters
Returns
WithScrollbar(bool)
Sets whether to show the scrollbar
public ScrollablePanelBuilder WithScrollbar(bool show = true)
Parameters
showboolTrue to show scrollbar
Returns
- ScrollablePanelBuilder
The builder for chaining
WithScrollbarPosition(ScrollbarPosition)
Sets the scrollbar position
public ScrollablePanelBuilder WithScrollbarPosition(ScrollbarPosition position)
Parameters
positionScrollbarPositionThe scrollbar position (Left or Right)
Returns
- ScrollablePanelBuilder
The builder for chaining
WithStickyPosition(StickyPosition)
Sets the sticky position
public ScrollablePanelBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPositionThe sticky position
Returns
- ScrollablePanelBuilder
The builder for chaining
WithTag(object)
Sets the control tag for custom data storage
public ScrollablePanelBuilder WithTag(object tag)
Parameters
tagobjectThe tag object
Returns
- ScrollablePanelBuilder
The builder for chaining
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment
public ScrollablePanelBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignmentThe vertical alignment
Returns
- ScrollablePanelBuilder
The builder for chaining
WithVerticalScroll(ScrollMode)
Sets the vertical scroll mode
public ScrollablePanelBuilder WithVerticalScroll(ScrollMode mode = ScrollMode.Scroll)
Parameters
modeScrollModeThe scroll mode (None, Scroll, or Wrap)
Returns
- ScrollablePanelBuilder
The builder for chaining
WithWidth(int)
Sets the width
public ScrollablePanelBuilder WithWidth(int width)
Parameters
widthintThe width
Returns
- ScrollablePanelBuilder
The builder for chaining
Operators
implicit operator ScrollablePanelControl(ScrollablePanelBuilder)
Implicit conversion to ScrollablePanelControl
public static implicit operator ScrollablePanelControl(ScrollablePanelBuilder builder)
Parameters
builderScrollablePanelBuilder