Class CollapsiblePanelBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for creating CollapsiblePanel instances.
public sealed class CollapsiblePanelBuilder : IControlBuilder<CollapsiblePanel>
- Inheritance
-
CollapsiblePanelBuilder
- Implements
- Inherited Members
- Extension Methods
Methods
AddControl(IWindowControl)
Adds a child control to the panel body.
public CollapsiblePanelBuilder AddControl(IWindowControl control)
Parameters
controlIWindowControl
Returns
Animated()
Enables height-based expand/collapse animation.
public CollapsiblePanelBuilder Animated()
Returns
Bordered()
Renders the header as a bordered box (title embedded in the top border).
public CollapsiblePanelBuilder Bordered()
Returns
Build()
Builds the configured CollapsiblePanel.
public CollapsiblePanel Build()
Returns
Collapsed()
Starts the panel in the collapsed state.
public CollapsiblePanelBuilder Collapsed()
Returns
Collapsible(bool)
Controls whether the panel can be collapsed/expanded by the user (default true).
public CollapsiblePanelBuilder Collapsible(bool collapsible = true)
Parameters
collapsiblebool
Returns
Expanded()
Starts the panel in the expanded state.
public CollapsiblePanelBuilder Expanded()
Returns
HideHeader()
Hides the header row. A collapsible panel always shows its header regardless.
public CollapsiblePanelBuilder HideHeader()
Returns
NonCollapsible()
Makes the panel a plain, non-collapsible container (locked expanded, pass-through focus).
public CollapsiblePanelBuilder NonCollapsible()
Returns
OnExpandedChanged(EventHandler<bool>)
Subscribes a handler to the ExpandedChanged event.
public CollapsiblePanelBuilder OnExpandedChanged(EventHandler<bool> handler)
Parameters
handlerEventHandler<bool>
Returns
Outline(bool)
Renders the panel in outline style (lighter role chrome).
public CollapsiblePanelBuilder Outline(bool outline = true)
Parameters
outlineboolWhether to use outline style.
Returns
Rounded()
Renders the header as a bordered box with rounded corners (╭╮╰╯).
public CollapsiblePanelBuilder Rounded()
Returns
ShowHeader(bool)
Controls whether the header row is drawn (default true).
public CollapsiblePanelBuilder ShowHeader(bool show = true)
Parameters
showbool
Returns
Visible(bool)
Sets the visibility
public CollapsiblePanelBuilder Visible(bool visible = true)
Parameters
visibleboolWhether the panel is visible
Returns
- CollapsiblePanelBuilder
The builder for chaining
WithAnimation(CollapsibleAnimationMode)
Sets how expand/collapse transitions are animated.
public CollapsiblePanelBuilder WithAnimation(CollapsibleAnimationMode mode)
Parameters
Returns
WithBackgroundColor(Color)
Sets the background color.
public CollapsiblePanelBuilder WithBackgroundColor(Color color)
Parameters
colorColor
Returns
WithBorderColor(Color)
Sets the border color.
public CollapsiblePanelBuilder WithBorderColor(Color color)
Parameters
colorColor
Returns
WithCollapsedIcon(string)
Sets the indicator icon shown when the panel is collapsed.
public CollapsiblePanelBuilder WithCollapsedIcon(string icon)
Parameters
iconstring
Returns
WithColorRole(ColorRole, ThemeMode?)
Sets the control's semantic colour role, which tints the panel border/header chrome.
public CollapsiblePanelBuilder WithColorRole(ColorRole role, ThemeMode? mode = null)
Parameters
roleColorRoleThe semantic role determining the panel's chrome colour.
modeThemeMode?Optional ThemeMode override for dark/light role-colour derivation. When null, the active theme's mode is used.
Returns
WithExpandedIcon(string)
Sets the indicator icon shown when the panel is expanded.
public CollapsiblePanelBuilder WithExpandedIcon(string icon)
Parameters
iconstring
Returns
WithFocusedBackgroundColor(Color)
Sets the header background color used when the panel has keyboard focus.
public CollapsiblePanelBuilder WithFocusedBackgroundColor(Color color)
Parameters
colorColor
Returns
WithFocusedColors(Color, Color)
Sets both the header foreground and background colors used when the panel has keyboard focus.
public CollapsiblePanelBuilder WithFocusedColors(Color foreground, Color background)
Parameters
Returns
WithFocusedForegroundColor(Color)
Sets the header foreground color used when the panel has keyboard focus.
public CollapsiblePanelBuilder WithFocusedForegroundColor(Color color)
Parameters
colorColor
Returns
WithForegroundColor(Color)
Sets the foreground color.
public CollapsiblePanelBuilder WithForegroundColor(Color color)
Parameters
colorColor
Returns
WithHeaderAlignment(HorizontalAlignment)
Sets the horizontal alignment of the header content.
public CollapsiblePanelBuilder WithHeaderAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignment
Returns
WithHeaderSeparator(bool)
Controls whether a separator is drawn under the header.
public CollapsiblePanelBuilder WithHeaderSeparator(bool show = true)
Parameters
showbool
Returns
WithHeaderStyle(CollapsibleHeaderStyle)
Sets the visual style used to render the header.
public CollapsiblePanelBuilder WithHeaderStyle(CollapsibleHeaderStyle style)
Parameters
styleCollapsibleHeaderStyle
Returns
WithIcons(string, string)
Sets both the expanded and collapsed indicator icons.
public CollapsiblePanelBuilder WithIcons(string expanded, string collapsed)
Parameters
Returns
WithMargin(Margin)
Sets the panel margin.
public CollapsiblePanelBuilder WithMargin(Margin margin)
Parameters
marginMargin
Returns
WithMargin(int)
Sets a uniform margin on all sides.
public CollapsiblePanelBuilder WithMargin(int margin)
Parameters
marginint
Returns
WithMargin(int, int, int, int)
Sets the panel margin (left, top, right, bottom).
public CollapsiblePanelBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
WithMaxContentHeight(int)
Caps the visible body height to the specified number of rows.
public CollapsiblePanelBuilder WithMaxContentHeight(int rows)
Parameters
rowsint
Returns
WithName(string)
Sets the control name for FindControl queries.
public CollapsiblePanelBuilder WithName(string name)
Parameters
namestring
Returns
WithTitle(string)
Sets the header title text.
public CollapsiblePanelBuilder WithTitle(string title)
Parameters
titlestring
Returns
WithWidth(int)
Sets the fixed width of the panel.
public CollapsiblePanelBuilder WithWidth(int width)
Parameters
widthint
Returns
Operators
implicit operator CollapsiblePanel(CollapsiblePanelBuilder)
Implicit conversion to CollapsiblePanel.
public static implicit operator CollapsiblePanel(CollapsiblePanelBuilder builder)
Parameters
builderCollapsiblePanelBuilder