Show / Hide Table of Contents

Class ComboBox

Represents a button that can be toggled on/off within a group of other buttons.

Inheritance
object
ControlBase
ButtonBase
ToggleButtonBase
CheckBox
ComboBox
Inherited Members
CheckBox.OnClick()
CheckBox.CreateControlSurface()
CheckBox.EstimateControlSurface()
CheckBox.LeftBracketGlyph
CheckBox.RightBracketGlyph
CheckBox.CheckedIconGlyph
CheckBox.UncheckedIconGlyph
CheckBox.CheckedIconColor
CheckBox.UncheckedIconColor
CheckBox.BracketsThemeState
CheckBox.IconThemeState
ToggleButtonBase.IsSelected
ToggleButtonBase.IsSelectedChanged
ButtonBase._textAlignment
ButtonBase.InvokeClick(bool)
ButtonBase.ProcessKeyboard(Keyboard)
ButtonBase.OnMouseIn(ControlBase.ControlMouseState)
ButtonBase.OnLeftMouseClicked(ControlBase.ControlMouseState)
ButtonBase.OnMouseExit(ControlBase.ControlMouseState)
ButtonBase.Text
ButtonBase.AutoSize
ButtonBase.TextAlignment
ButtonBase.Click
ControlBase.MouseState_IsMouseOver
ControlBase.MouseState_EnteredWithButtonDown
ControlBase.MouseState_IsMouseLeftDown
ControlBase.MouseState_IsMouseRightDown
ControlBase.OnUnfocused()
ControlBase.OnFocused()
ControlBase.OnIsDirtyChanged()
ControlBase.ProcessMouse(MouseScreenObjectState)
ControlBase.LostMouse(MouseScreenObjectState)
ControlBase.OnParentChanged()
ControlBase.OnPositionChanged()
ControlBase.PlaceRelativeTo(ControlBase, Direction.Types, int)
ControlBase.DetermineState()
ControlBase.OnStateChanged(ControlStates, ControlStates)
ControlBase.OnSurfaceChanged(ICellSurface, ICellSurface)
ControlBase.FindThemeFont()
ControlBase.FindThemeColors()
ControlBase.SetThemeColors(Colors)
ControlBase.HasThemeColors()
ControlBase.Resize(int, int)
ControlBase.OnResized()
ControlBase.OnMouseEnter(ControlBase.ControlMouseState)
ControlBase.OnRightMouseClicked(ControlBase.ControlMouseState)
ControlBase.ThemeState
ControlBase.UseKeyboard
ControlBase.UseMouse
ControlBase.CanFocus
ControlBase.CanResize
ControlBase.AlternateFont
ControlBase.Surface
ControlBase.MouseArea
ControlBase.IsMouseButtonStateClean
ControlBase.Position
ControlBase.AbsolutePosition
ControlBase.IsVisible
ControlBase.Tag
ControlBase.TabStop
ControlBase.TabIndex
ControlBase.IsDirty
ControlBase.Name
ControlBase.FocusOnMouseClick
ControlBase.Width
ControlBase.Height
ControlBase.IsFocused
ControlBase.IsEnabled
ControlBase.Bounds
ControlBase.Parent
ControlBase.State
ControlBase.IsDirtyChanged
ControlBase.Focused
ControlBase.Unfocused
ControlBase.PositionChanged
ControlBase.MouseEnter
ControlBase.MouseExit
ControlBase.MouseMove
ControlBase.MouseButtonClicked
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.UI.Controls
Assembly: SadConsole.dll
Syntax
[DataContract]
public class ComboBox : CheckBox

Constructors

ComboBox(int, int, int, object[])

Creates a new instance of the combobox control.

Declaration
public ComboBox(int width, int dropdownWidth, int dropdownHeight, object[] items)
Parameters
Type Name Description
int width

The width of the control.

int dropdownWidth

The width of the dropdown container.

int dropdownHeight

The height of the dropdown container.

object[] items

The items to seed the dropdown with.

Fields

DropdownContainer

Surface that contains the listbox

Declaration
protected readonly ScreenSurface DropdownContainer
Field Value
Type Description
ScreenSurface

ListBox

Listbox used to control the items

Declaration
protected readonly ListBox ListBox
Field Value
Type Description
ListBox

Properties

CollapsedButtonGlyph

The glyph to use on the control when it's collapsed.

Declaration
[DataMember]
public int CollapsedButtonGlyph { get; set; }
Property Value
Type Description
int

ExpandedButtonGlyph

The glyph to use on the control when it's expanded.

Declaration
[DataMember]
public int ExpandedButtonGlyph { get; set; }
Property Value
Type Description
int

PopupHorizontal

Sets the horizontal orientation of the of the dropdown popup.

Declaration
[DataMember]
public HorizontalAlignment PopupHorizontal { get; set; }
Property Value
Type Description
HorizontalAlignment

PopupInnerAligned

When true, uses the PopupHorizontal value from the interior of the control. When false, it's used from the outside of the control.

Declaration
[DataMember]
public bool PopupInnerAligned { get; set; }
Property Value
Type Description
bool

PopupVertical

Sets the vertical orientation of the of the dropdown popup.

Declaration
[DataMember]
public VerticalAlignment PopupVertical { get; set; }
Property Value
Type Description
VerticalAlignment

SelectedIndex

Gets or sets the index of the selected item.

Declaration
public int SelectedIndex { get; set; }
Property Value
Type Description
int

SelectedItem

Gets or sets the selected item.

Declaration
public object? SelectedItem { get; set; }
Property Value
Type Description
object

Methods

GetItems()

Gets an array of items from the dropdown listbox.

Declaration
public object[] GetItems()
Returns
Type Description
object[]

OnIsSelected()

When IsSelected is true, displays the popup container. When false, hides the popup container.

Declaration
protected override void OnIsSelected()
Overrides
ToggleButtonBase.OnIsSelected()

RefreshThemeStateColors(Colors)

Updates the ThemeState by calling RefreshTheme(Colors) with the provided colors. Override this method to adjust how colors are used by the ThemeState.

Declaration
protected override void RefreshThemeStateColors(Colors colors)
Parameters
Type Name Description
Colors colors

The colors to apply to the theme state.

Overrides
CheckBox.RefreshThemeStateColors(Colors)

RepositionOffScreenContainer()

Checks if the dropdown container is off-screen, and pushes it back in.

Declaration
protected void RepositionOffScreenContainer()

ResizeDropDown(int?, int?)

Resizes the dropdown container to the given width/height

Declaration
public void ResizeDropDown(int? width = null, int? height = null)
Parameters
Type Name Description
int? width

Width of the dropdown

int? height

Height of the dropdown

SetItems(params object[])

Sets the items in the dropdown listbox.

Declaration
public void SetItems(params object[] items)
Parameters
Type Name Description
object[] items

The items to set.

UpdateAndRedraw(TimeSpan)

Redraws the control if applicable.

Declaration
public override void UpdateAndRedraw(TimeSpan time)
Parameters
Type Name Description
TimeSpan time

The duration of thecurrent frame.

Overrides
CheckBox.UpdateAndRedraw(TimeSpan)

Events

SelectedItemChanged

An event that triggers when the SelectedItem property changes.

Declaration
public event EventHandler<ListBox.SelectedItemEventArgs>? SelectedItemChanged
Event Type
Type Description
EventHandler<ListBox.SelectedItemEventArgs>

Extension Methods

ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX