Show / Hide Table of Contents

# Class ComboBox

ComboBox control

##### Inheritance

System.Object
Responder
View
ComboBox

##### Implements

System.IDisposable
System.Collections.IEnumerable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize

##### Inherited Members

View.Added
View.Removed
View.Enter
View.Leave
View.MouseEnter
View.MouseLeave
View.MouseClick
View.HotKey
View.HotKeySpecifier
View.Driver
View.Subviews
View.TabIndexes
View.TabIndex
View.TabStop
View.CanFocus
View.Id
View.IsCurrentTop
View.WantMousePositionReports
View.WantContinuousButtonPressed
View.Frame
View.GetEnumerator()
View.LayoutStyle
View.Bounds
View.X
View.Y
View.Width
View.Height
View.SuperView
View.SetNeedsDisplay()
View.SetNeedsDisplay(Rect)
View.ChildNeedsDisplay()
View.Add(View)
View.Add(View[])
View.RemoveAll()
View.Remove(View)
View.BringSubviewToFront(View)
View.SendSubviewToBack(View)
View.SendSubviewBackwards(View)
View.BringSubviewForward(View)
View.Clear()
View.Clear(Rect)
View.ScreenToView(Int32, Int32)
View.ClipToBounds()
View.SetClip(Rect)
View.DrawFrame(Rect, Int32, Boolean)
View.DrawHotString(ustring, Attribute, Attribute)
View.DrawHotString(ustring, Boolean, ColorScheme)
View.Move(Int32, Int32)
View.PositionCursor()
View.HasFocus
View.OnAdded(View)
View.OnRemoved(View)
View.Focused
View.MostFocused
View.AddRune(Int32, Int32, Rune)
View.ClearNeedsDisplay()
View.DrawContent
View.OnDrawContent(Rect)
View.SetFocus(View)
View.KeyPress
View.ProcessHotKey(KeyEvent)
View.ProcessColdKey(KeyEvent)
View.KeyDown
View.OnKeyDown(KeyEvent)
View.KeyUp
View.OnKeyUp(KeyEvent)
View.EnsureFocus()
View.FocusFirst()
View.FocusLast()
View.FocusPrev()
View.FocusNext()
View.LayoutStarted
View.LayoutComplete
View.Initialized
View.LayoutSubviews()
View.TextAlignment
View.IsInitialized
View.ToString()
View.OnMouseEnter(MouseEvent)
View.OnMouseLeave(MouseEvent)
View.OnMouseEvent(MouseEvent)
View.Dispose(Boolean)
View.BeginInit()
View.EndInit()
Responder.Dispose()
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, IEnumerable, ISupportInitializeNotification, ISupportInitialize

### Constructors

#### ComboBox()

Public constructor

##### Declaration

    public ComboBox()

#### ComboBox(ustring)

Public constructor

##### Declaration

    public ComboBox(ustring text)

##### Parameters

Type | Name | Description
--- | --- | ---
NStack.ustring | text |

#### ComboBox(Rect, IList)

Public constructor

##### Declaration

    public ComboBox(Rect rect, IList source)

##### Parameters

Type | Name | Description
--- | --- | ---
Rect | rect |
System.Collections.IList | source |

### Fields

#### OpenSelectedItem

This event is raised when the user Double Clicks on an item or presses ENTER to open the selected item.

##### Declaration

    public Action<ListViewItemEventArgs> OpenSelectedItem

##### Field Value

Type | Description
--- | ---
System.Action<ListViewItemEventArgs> |

#### SelectedItemChanged

This event is raised when the selected item in the ComboBox has changed.

##### Declaration

    public Action<ListViewItemEventArgs> SelectedItemChanged

##### Field Value

Type | Description
--- | ---
System.Action<ListViewItemEventArgs> |

### Properties

#### ColorScheme

##### Declaration

    public ColorScheme ColorScheme { get; set; }

##### Property Value

Type | Description
--- | ---
ColorScheme |

#### SelectedItem

Gets the index of the currently selected item in the Source

##### Declaration

    public int SelectedItem { get; }

##### 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.

##### Remarks

Use SetSource(IList) to set a new System.Collections.IList source.

#### Text

The currently selected list item

##### Declaration

    public ustring Text { get; set; }

##### Property Value

Type | Description
--- | ---
NStack.ustring |

### Methods

#### MouseEvent(MouseEvent)

##### Declaration

    public override bool MouseEvent(MouseEvent me)

##### Parameters

Type | Name | Description
--- | --- | ---
MouseEvent | me |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Overrides

Responder.MouseEvent(MouseEvent)

#### OnEnter(View)

##### Declaration

    public override bool OnEnter(View view)

##### Parameters

Type | Name | Description
--- | --- | ---
View | view |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Overrides

View.OnEnter(View)

#### OnLeave(View)

##### Declaration

    public override bool OnLeave(View view)

##### Parameters

Type | Name | Description
--- | --- | ---
View | view |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Overrides

View.OnLeave(View)

#### OnOpenSelectedItem()

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)

##### Declaration

    public override bool ProcessKey(KeyEvent e)

##### Parameters

Type | Name | Description
--- | --- | ---
KeyEvent | e |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Overrides

View.ProcessKey(KeyEvent)

#### Redraw(Rect)

##### Declaration

    public override void Redraw(Rect bounds)

##### Parameters

Type | Name | Description
--- | --- | ---
Rect | bounds |

##### Overrides

View.Redraw(Rect)

#### SetSource(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 |

##### Remarks

Use the Source property to set a new IListDataSource source and use custome rendering.

### Implements

System.IDisposable
System.Collections.IEnumerable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize