Class ComboBox
Represents a button that can be toggled on/off within a group of other buttons.
Inherited Members
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
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
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
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
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> |