Class ComboBox
Provides a drop-down list of items the user can select from.
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class ComboBox : View, IDisposable, ISupportInitializeNotification, ISupportInitialize
Constructors
| Improve this Doc View SourceComboBox()
Public constructor
Declaration
public ComboBox()
ComboBox(IList)
Initialize with the source.
Declaration
public ComboBox(IList source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IList | source | The source. |
ComboBox(Rect, IList)
Public constructor
Declaration
public ComboBox(Rect rect, IList source)
Parameters
Type | Name | Description |
---|---|---|
Rect | rect | |
System.Collections.IList | source |
ComboBox(ustring)
Public constructor
Declaration
public ComboBox(ustring text)
Parameters
Type | Name | Description |
---|---|---|
ustring | text |
Properties
| Improve this Doc View SourceColorScheme
Declaration
public ColorScheme ColorScheme { get; set; }
Property Value
Type | Description |
---|---|
ColorScheme |
HideDropdownListOnClick
Gets or sets if the drop-down list can be hide with a button click event.
Declaration
public bool HideDropdownListOnClick { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsShow
Gets the drop down list state, expanded or collapsed.
Declaration
public bool IsShow { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ReadOnly
If set to true its not allow any changes in the text.
Declaration
public bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
SearchText
Current search text
Declaration
public ustring SearchText { get; set; }
Property Value
Type | Description |
---|---|
ustring |
SelectedItem
Gets the index of the currently selected item in the Source
Declaration
public int SelectedItem { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The selected item or -1 none selected. |
Source
Gets or sets the IListDataSource backing this ComboBox, enabling custom rendering.
Declaration
public IListDataSource Source { get; set; }
Property Value
Type | Description |
---|---|
IListDataSource | The source. |
Text
The currently selected list item
Declaration
public ustring Text { get; set; }
Property Value
Type | Description |
---|---|
ustring |
Methods
| Improve this Doc View SourceCollapse()
Collapses the drop down list. Returns true if the state chagned or false
if it was already collapsed and no action was taken
Declaration
public virtual bool Collapse()
Returns
Type | Description |
---|---|
System.Boolean |
Expand()
Expands the drop down list. Returns true if the state chagned or false
if it was already expanded and no action was taken
Declaration
public virtual bool Expand()
Returns
Type | Description |
---|---|
System.Boolean |
MouseEvent(MouseEvent)
Method invoked when a mouse event is generated
Declaration
public override bool MouseEvent(MouseEvent me)
Parameters
Type | Name | Description |
---|---|---|
MouseEvent | me |
Returns
Type | Description |
---|---|
System.Boolean | true , if the event was handled, false otherwise. |
Overrides
| Improve this Doc View SourceOnCollapsed()
Virtual method which invokes the Collapsed event.
Declaration
public virtual void OnCollapsed()
OnEnter(View)
Method invoked when a view gets focus.
Declaration
public override bool OnEnter(View view)
Parameters
Type | Name | Description |
---|---|---|
View | view | The view that is losing focus. |
Returns
Type | Description |
---|---|
System.Boolean | true , if the event was handled, false otherwise. |
Overrides
| Improve this Doc View SourceOnExpanded()
Virtual method which invokes the Expanded event.
Declaration
public virtual void OnExpanded()
OnLeave(View)
Method invoked when a view loses focus.
Declaration
public override bool OnLeave(View view)
Parameters
Type | Name | Description |
---|---|---|
View | view | The view that is getting focus. |
Returns
Type | Description |
---|---|
System.Boolean | true , if the event was handled, false otherwise. |
Overrides
| Improve this Doc View SourceOnOpenSelectedItem()
Invokes the OnOpenSelectedItem event if it is defined.
Declaration
public virtual bool OnOpenSelectedItem()
Returns
Type | Description |
---|---|
System.Boolean |
OnSelectedChanged()
Invokes the SelectedChanged event if it is defined.
Declaration
public virtual bool OnSelectedChanged()
Returns
Type | Description |
---|---|
System.Boolean |
ProcessKey(KeyEvent)
If the view is focused, gives the view a
chance to process the keystroke.
Declaration
public override bool ProcessKey(KeyEvent e)
Parameters
Type | Name | Description |
---|---|---|
KeyEvent | e |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceRedraw(Rect)
Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.
Declaration
public override void Redraw(Rect bounds)
Parameters
Type | Name | Description |
---|---|---|
Rect | bounds | The bounds (view-relative region) to redraw. |
Overrides
| Improve this Doc View SourceSetSource(IList)
Sets the source of the ComboBox to an System.Collections.IList.
Declaration
public void SetSource(IList source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IList | source |
Events
| Improve this Doc View SourceCollapsed
This event is raised when the drop-down list is collapsed.
Declaration
public event Action Collapsed
Event Type
Type | Description |
---|---|
System.Action |
Expanded
This event is raised when the drop-down list is expanded.
Declaration
public event Action Expanded
Event Type
Type | Description |
---|---|
System.Action |
OpenSelectedItem
This event is raised when the user Double Clicks on an item or presses ENTER to open the selected item.
Declaration
public event Action<ListViewItemEventArgs> OpenSelectedItem
Event Type
Type | Description |
---|---|
System.Action<ListViewItemEventArgs> |
SelectedItemChanged
This event is raised when the selected item in the ComboBox has changed.
Declaration
public event Action<ListViewItemEventArgs> SelectedItemChanged
Event Type
Type | Description |
---|---|
System.Action<ListViewItemEventArgs> |
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize