Table of Contents

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

item DropdownItem

Returns

DropdownBuilder

AddItem(string, string?, Color?)

Adds an item to the dropdown

public DropdownBuilder AddItem(string text, string? value = null, Color? color = null)

Parameters

text string
value string
color Color?

Returns

DropdownBuilder

AddItems(IEnumerable<DropdownItem>)

Adds multiple DropdownItems to the dropdown

public DropdownBuilder AddItems(IEnumerable<DropdownItem> items)

Parameters

items IEnumerable<DropdownItem>

Returns

DropdownBuilder

AddItems(params string[])

Adds multiple items to the dropdown

public DropdownBuilder AddItems(params string[] items)

Parameters

items string[]

Returns

DropdownBuilder

Build()

Builds the dropdown control

public DropdownControl Build()

Returns

DropdownControl

OnGotFocus(WindowEventHandler<EventArgs>)

Sets the GotFocus event handler with window access

public DropdownBuilder OnGotFocus(WindowEventHandler<EventArgs> handler)

Parameters

handler WindowEventHandler<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

handler EventHandler

The 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

handler WindowEventHandler<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

handler EventHandler

The 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

handler WindowEventHandler<DropdownItem>

Returns

DropdownBuilder

OnSelectedItemChanged(EventHandler<DropdownItem?>)

Sets the selected item changed event handler

public DropdownBuilder OnSelectedItemChanged(EventHandler<DropdownItem?> handler)

Parameters

handler EventHandler<DropdownItem>

Returns

DropdownBuilder

OnSelectedValueChanged(WindowEventHandler<string?>)

Sets the selected value changed event handler with window access

public DropdownBuilder OnSelectedValueChanged(WindowEventHandler<string?> handler)

Parameters

handler WindowEventHandler<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

handler EventHandler<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

handler WindowEventHandler<int>

Returns

DropdownBuilder

OnSelectionChanged(EventHandler<int>)

Sets the selection changed event handler (index-based)

public DropdownBuilder OnSelectionChanged(EventHandler<int> handler)

Parameters

handler EventHandler<int>

Returns

DropdownBuilder

SelectedIndex(int)

Sets the initially selected index

public DropdownBuilder SelectedIndex(int index)

Parameters

index int

Returns

DropdownBuilder

StickyBottom()

Makes the control stick to the bottom of the window

public DropdownBuilder StickyBottom()

Returns

DropdownBuilder

StickyTop()

Makes the control stick to the top of the window

public DropdownBuilder StickyTop()

Returns

DropdownBuilder

Visible(bool)

Sets the visibility

public DropdownBuilder Visible(bool visible = true)

Parameters

visible bool

Returns

DropdownBuilder

WithAlignment(HorizontalAlignment)

Sets the horizontal alignment

public DropdownBuilder WithAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

Returns

DropdownBuilder

WithMargin(int)

Sets uniform margin

public DropdownBuilder WithMargin(int margin)

Parameters

margin int

Returns

DropdownBuilder

WithMargin(int, int, int, int)

Sets the margin

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

Parameters

left int
top int
right int
bottom int

Returns

DropdownBuilder

WithName(string)

Sets the control name for lookup

public DropdownBuilder WithName(string name)

Parameters

name string

Returns

DropdownBuilder

WithPrompt(string)

Sets the dropdown prompt text

public DropdownBuilder WithPrompt(string prompt)

Parameters

prompt string

Returns

DropdownBuilder

WithStickyPosition(StickyPosition)

Sets the sticky position

public DropdownBuilder WithStickyPosition(StickyPosition position)

Parameters

position StickyPosition

Returns

DropdownBuilder

WithTag(object)

Sets a tag object

public DropdownBuilder WithTag(object tag)

Parameters

tag object

Returns

DropdownBuilder

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment

public DropdownBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

Returns

DropdownBuilder

WithWidth(int)

Sets the width

public DropdownBuilder WithWidth(int width)

Parameters

width int

Returns

DropdownBuilder

Operators

implicit operator DropdownControl(DropdownBuilder)

Implicit conversion to DropdownControl

public static implicit operator DropdownControl(DropdownBuilder builder)

Parameters

builder DropdownBuilder

Returns

DropdownControl