Skip to content

ComboBox Class

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

C#
[DataContract]
public class ComboBox : CheckBox

Inheritance objectControlBaseButtonBaseToggleButtonBaseCheckBox

Creates a new instance of the combobox control.

C#
public ComboBox(int width, int dropdownWidth, int dropdownHeight, object[] items)

width int
The width of the control.

dropdownWidth int
The width of the dropdown container.

dropdownHeight int
The height of the dropdown container.

items object[]
The items to seed the dropdown with.

Surface that contains the listbox

C#
protected readonly ScreenSurface DropdownContainer

Listbox used to control the items

C#
protected readonly ListBox ListBox

Gets or sets the index of the selected item.

C#
public int SelectedIndex { get; set; }

Gets or sets the selected item.

C#
public object? SelectedItem { get; set; }

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

C#
[DataMember]
public bool PopupInnerAligned { get; set; }

Sets the horizontal orientation of the of the dropdown popup.

C#
[DataMember]
public HorizontalAlignment PopupHorizontal { get; set; }

Sets the vertical orientation of the of the dropdown popup.

C#
[DataMember]
public VerticalAlignment PopupVertical { get; set; }

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

C#
[DataMember]
public int CollapsedButtonGlyph { get; set; }

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

C#
[DataMember]
public int ExpandedButtonGlyph { get; set; }

Resizes the dropdown container to the given width/height

C#
public void ResizeDropDown(int? width = null, int? height = null)

width int?
Width of the dropdown

height int?
Height of the dropdown

Sets the items in the dropdown listbox.

C#
public void SetItems(params object[] items)

items object[]
The items to set.

Gets an array of items from the dropdown listbox.

C#
public object[] GetItems()

object[]

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

C#
protected void RepositionOffScreenContainer()

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

C#
protected override void OnIsSelected()

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

C#
protected override void RefreshThemeStateColors(Colors colors)

colors Colors
The colors to apply to the theme state.

Redraws the control if applicable.

C#
public override void UpdateAndRedraw(TimeSpan time)

time TimeSpan
The duration of thecurrent frame.

An event that triggers when the SelectedItem property changes.

C#
public event EventHandler<ListBox.SelectedItemEventArgs>? SelectedItemChanged

EventHandler<ListBox.SelectedItemEventArgs>