Class DropdownBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for dropdown controls
public sealed class DropdownBuilder
- Inheritance
-
DropdownBuilder
- Inherited Members
Methods
AddItem(DropdownItem)
Adds a DropdownItem to the dropdown
public DropdownBuilder AddItem(DropdownItem item)
Parameters
itemDropdownItem
Returns
AddItem(string, string?, Color?)
Adds an item to the dropdown
public DropdownBuilder AddItem(string text, string? value = null, Color? color = null)
Parameters
Returns
AddItems(IEnumerable<DropdownItem>)
Adds multiple DropdownItems to the dropdown
public DropdownBuilder AddItems(IEnumerable<DropdownItem> items)
Parameters
itemsIEnumerable<DropdownItem>
Returns
AddItems(params string[])
Adds multiple items to the dropdown
public DropdownBuilder AddItems(params string[] items)
Parameters
itemsstring[]
Returns
Build()
Builds the dropdown control
public DropdownControl Build()
Returns
OnGotFocus(WindowEventHandler<EventArgs>)
Sets the GotFocus event handler with window access
public DropdownBuilder OnGotFocus(WindowEventHandler<EventArgs> handler)
Parameters
handlerWindowEventHandler<EventArgs>Handler that receives sender, event data, and window
Returns
- DropdownBuilder
The builder for chaining
OnGotFocus(EventHandler)
Sets the GotFocus event handler
public DropdownBuilder OnGotFocus(EventHandler handler)
Parameters
handlerEventHandlerThe event handler to invoke when the dropdown receives focus
Returns
- DropdownBuilder
The builder for chaining
OnLostFocus(WindowEventHandler<EventArgs>)
Sets the LostFocus event handler with window access
public DropdownBuilder OnLostFocus(WindowEventHandler<EventArgs> handler)
Parameters
handlerWindowEventHandler<EventArgs>Handler that receives sender, event data, and window
Returns
- DropdownBuilder
The builder for chaining
OnLostFocus(EventHandler)
Sets the LostFocus event handler
public DropdownBuilder OnLostFocus(EventHandler handler)
Parameters
handlerEventHandlerThe event handler to invoke when the dropdown loses focus
Returns
- DropdownBuilder
The builder for chaining
OnSelectedItemChanged(WindowEventHandler<DropdownItem?>)
Sets the selected item changed event handler with window access
public DropdownBuilder OnSelectedItemChanged(WindowEventHandler<DropdownItem?> handler)
Parameters
handlerWindowEventHandler<DropdownItem>
Returns
OnSelectedItemChanged(EventHandler<DropdownItem?>)
Sets the selected item changed event handler
public DropdownBuilder OnSelectedItemChanged(EventHandler<DropdownItem?> handler)
Parameters
handlerEventHandler<DropdownItem>
Returns
OnSelectedValueChanged(WindowEventHandler<string?>)
Sets the selected value changed event handler with window access
public DropdownBuilder OnSelectedValueChanged(WindowEventHandler<string?> handler)
Parameters
handlerWindowEventHandler<string>Handler that receives sender, event data, and window
Returns
- DropdownBuilder
The builder for chaining
OnSelectedValueChanged(EventHandler<string?>)
Sets the selected value changed event handler
public DropdownBuilder OnSelectedValueChanged(EventHandler<string?> handler)
Parameters
handlerEventHandler<string>The event handler to invoke when the selected value changes
Returns
- DropdownBuilder
The builder for chaining
OnSelectionChanged(WindowEventHandler<int>)
Sets the selection changed event handler with window access
public DropdownBuilder OnSelectionChanged(WindowEventHandler<int> handler)
Parameters
handlerWindowEventHandler<int>
Returns
OnSelectionChanged(EventHandler<int>)
Sets the selection changed event handler (index-based)
public DropdownBuilder OnSelectionChanged(EventHandler<int> handler)
Parameters
handlerEventHandler<int>
Returns
SelectedIndex(int)
Sets the initially selected index
public DropdownBuilder SelectedIndex(int index)
Parameters
indexint
Returns
StickyBottom()
Makes the control stick to the bottom of the window
public DropdownBuilder StickyBottom()
Returns
StickyTop()
Makes the control stick to the top of the window
public DropdownBuilder StickyTop()
Returns
Visible(bool)
Sets the visibility
public DropdownBuilder Visible(bool visible = true)
Parameters
visiblebool
Returns
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment
public DropdownBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignment
Returns
WithMargin(int)
Sets uniform margin
public DropdownBuilder WithMargin(int margin)
Parameters
marginint
Returns
WithMargin(int, int, int, int)
Sets the margin
public DropdownBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
WithName(string)
Sets the control name for lookup
public DropdownBuilder WithName(string name)
Parameters
namestring
Returns
WithPrompt(string)
Sets the dropdown prompt text
public DropdownBuilder WithPrompt(string prompt)
Parameters
promptstring
Returns
WithStickyPosition(StickyPosition)
Sets the sticky position
public DropdownBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPosition
Returns
WithTag(object)
Sets a tag object
public DropdownBuilder WithTag(object tag)
Parameters
tagobject
Returns
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment
public DropdownBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignment
Returns
WithWidth(int)
Sets the width
public DropdownBuilder WithWidth(int width)
Parameters
widthint
Returns
Operators
implicit operator DropdownControl(DropdownBuilder)
Implicit conversion to DropdownControl
public static implicit operator DropdownControl(DropdownBuilder builder)
Parameters
builderDropdownBuilder