WinForms

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfComboBox - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfComboBox

    Represents a control that used to select single or multiple value from the drop down list.

    Inheritance
    System.Object
    BaseControl
    SfComboBox
    Implements
    IThemeProvider
    IVisualStyle
    System.IDisposable
    System.ComponentModel.ISupportInitialize
    Inherited Members
    BaseControl.GetActiveThemeName()
    BaseControl.ThemeName
    BaseControl.CanOverrideStyle
    BaseControl.IThemeProvider.BaseThemeName
    BaseControl.CanApplyTheme
    BaseControl.ControlName
    BaseControl.IVisualStyle.VisualTheme
    BaseControl.IsVisualStyleEnabled
    BaseControl.ThemeNameChanged
    Namespace: Syncfusion.WinForms.ListView
    Assembly: Syncfusion.SfListView.WinForms.dll
    Syntax
    [ComVisible(true)]
    public class SfComboBox : BaseControl, IThemeProvider, IVisualStyle, IDisposable, ISupportInitialize

    Constructors

    SfComboBox()

    Initializes a new instance of the SfComboBox class.

    Declaration
    public SfComboBox()

    Properties

    AllowCaseSensitiveOnAutoComplete

    Gets or sets a value indicating whether the autocomplete Suggest and SuggestAppend mode should be processed based on case sensitive.

    Declaration
    public bool AllowCaseSensitiveOnAutoComplete { get; set; }
    Property Value
    Type Description
    System.Boolean

    AllowDropDownResize

    Gets or sets a value indicating whether the drop down can be resized.

    Declaration
    public bool AllowDropDownResize { get; set; }
    Property Value
    Type Description
    System.Boolean

    AllowNull

    Gets or sets a value indicating whether null or empty string can be set to SfComboBox.

    Declaration
    public bool AllowNull { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    If AllowNull is true, the Watermark text will be shown in the SfComboBox. Otherwise, empty string will be shown.

    AllowSelectAll

    Gets or sets a value indicating whether the select all item can be shown at top of the dropdown to select whole items.

    Declaration
    public bool AllowSelectAll { get; set; }
    Property Value
    Type Description
    System.Boolean

    AutoCompleteMode

    Gets or sets the auto complete mode for SfComboBox.

    Declaration
    public AutoCompleteMode AutoCompleteMode { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.AutoCompleteMode

    AutoCompleteSuggestDelay

    Gets or sets the delay in milliseconds for and .

    Declaration
    public int AutoCompleteSuggestDelay { get; set; }
    Property Value
    Type Description
    System.Int32

    AutoCompleteSuggestMode

    Gets or sets the mode for suggesting the dropdown list of AutoComplete Suggest and SuggestAppend modes.

    Declaration
    public AutoCompleteSuggestMode AutoCompleteSuggestMode { get; set; }
    Property Value
    Type Description
    AutoCompleteSuggestMode

    BackColor

    Gets or sets the background color for the SfComboBox.

    Declaration
    public Color BackColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    BorderStyle

    Gets or sets border style of SfComboBox.

    Declaration
    public BorderStyle BorderStyle { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.BorderStyle

    CheckedItems

    Gets or sets the collection containing the checked items of SfComboBox.

    Declaration
    public ObservableCollection<object> CheckedItems { get; set; }
    Property Value
    Type Description
    System.Collections.ObjectModel.ObservableCollection<System.Object>

    ComboBoxMode

    Gets or sets the display mode for SfComboBox.

    Declaration
    public ComboBoxMode ComboBoxMode { get; set; }
    Property Value
    Type Description
    ComboBoxMode
    Remarks

    The ComboBoxMode cannot be changed while SfComboBox in disabled state.

    DataSource

    Gets or sets data source of the SfComboBox.

    Declaration
    public object DataSource { get; set; }
    Property Value
    Type Description
    System.Object

    DefaultSize

    Gets default size of the control

    Declaration
    protected override Size DefaultSize { get; }
    Property Value
    Type Description
    System.Drawing.Size

    DelimiterChar

    Gets or sets the delimiter character to separate the multiple selected items in the SfComboBox when the ComboBoxMode is .

    Declaration
    public string DelimiterChar { get; set; }
    Property Value
    Type Description
    System.String

    DisplayMember

    Gets or sets the property to display for the SfComboBox

    Declaration
    public string DisplayMember { get; set; }
    Property Value
    Type Description
    System.String

    DropDownButton

    Gets a button that used to represent the drop down portion of a SfComboBox.

    Declaration
    public SfButton DropDownButton { get; }
    Property Value
    Type Description
    SfButton

    DropDownControl

    Gets the popup control of the SfComboBox.

    Declaration
    public ComboBoxPopup DropDownControl { get; }
    Property Value
    Type Description
    ComboBoxPopup

    DropDownListView

    Gets the list view of SfComboBox.

    Declaration
    public SfListView DropDownListView { get; }
    Property Value
    Type Description
    SfListView

    DropDownPosition

    Gets or sets the position of the dropdown relative to the SfComboBox.

    Declaration
    public PopupRelativeAlignment DropDownPosition { get; set; }
    Property Value
    Type Description
    PopupRelativeAlignment

    The DropDownPosition value. The default value is Center

    DropDownStyle

    Gets or sets the value that specifies the editing style of the SfComboBox.

    Declaration
    public DropDownStyle DropDownStyle { get; set; }
    Property Value
    Type Description
    DropDownStyle

    EnableToken

    Gets or sets a value indicating whether to enable or disable token support in SfComboBox

    Declaration
    public bool EnableToken { get; set; }
    Property Value
    Type Description
    System.Boolean

    Filter

    Gets or sets the predicate to filters the values while typing text in editor portion of the SfComboBox.

    Declaration
    public Predicate<object> Filter { get; set; }
    Property Value
    Type Description
    System.Predicate<System.Object>
    Remarks

    AutoCompleteFilter is supported for System.Collections.IEnumerable collection type datasource. It does not support for DataTable datasource.

    Examples
    SfComboBox sfComboBox = new SfComboBox();
    // Add the list of numbers into the datasource
    sfComboBox.DataSource = number;
    // Set the predicate to filter the values
    sfComboBox.Filter = Search;
    bool Search(object item)
    {
       int number =  (int)sfComboBox.TextBox.Text;
       if( number > (int) item)
       {
          return true;
       }
    }

    Font

    Gets or sets the font of the text displayed by the control.

    Declaration
    public Font Font { get; set; }
    Property Value
    Type Description
    System.Drawing.Font

    ForeColor

    Gets or sets the foreground color for the SfComboBox.

    Declaration
    public Color ForeColor { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    MaxDropDownItems

    Gets or sets the maximum drop down items count when drop down is showing.

    Declaration
    public int MaxDropDownItems { get; set; }
    Property Value
    Type Description
    System.Int32

    Padding

    Gets or sets the padding value within the SfComboBox.

    Declaration
    public Padding Padding { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.Padding

    PreferredSize

    Gets the size of a rectangular area into which the control can fit.

    Declaration
    public Size PreferredSize { get; }
    Property Value
    Type Description
    System.Drawing.Size

    RightToLeft

    Gets or sets a value indicating whether control's elements are aligned to support locales using right to left fonts.

    Declaration
    public override RightToLeft RightToLeft { get; set; }
    Property Value
    Type Description
    System.Windows.Forms.RightToLeft

    SelectedIndex

    Gets or sets an index of the selected item SfComboBox.

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

    SelectedItem

    Gets or sets the currently selected item of SfComboBox.

    Declaration
    public object SelectedItem { get; set; }
    Property Value
    Type Description
    System.Object

    SelectedItems

    Gets or sets the collection of the selected items of SfComboBox.

    Declaration
    public ObservableCollection<object> SelectedItems { get; set; }
    Property Value
    Type Description
    System.Collections.ObjectModel.ObservableCollection<System.Object>

    SelectedValue

    Gets or sets selected value for SfComboBox.

    Declaration
    public object SelectedValue { get; set; }
    Property Value
    Type Description
    System.Object
    Remarks

    The SelectedValue returns the value based on ValueMember is it is defined.

    ShowClearButton

    Gets or sets a value indicating whether the clear button can be shown in the SfComboBox. When click the clear button, existing selection will clear in SfComboBox.

    Declaration
    public bool ShowClearButton { get; set; }
    Property Value
    Type Description
    System.Boolean

    If ShowClearButton is true, the clear button will be shown in the SfComboBox. Otherwise, false.

    Remarks

    The clear button will be shown in the SfComboBox for both single selection and multiple selection.

    ShowToolTip

    Gets or sets a value indicating whether tool tip can be shown when mouse hover on editor portion of the SfComboBox for MultiSelection ComboBox.

    Declaration
    public bool ShowToolTip { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Tool tip will be shown when ComboBoxMode is .

    Site

    Gets or sets the value of site to override deafult value of Text property.

    Declaration
    public override ISite Site { get; set; }
    Property Value
    Type Description
    System.ComponentModel.ISite

    Style

    Gets or sets the style for the SfComboBox elements.

    Declaration
    public ComboBoxVisualStyle Style { get; set; }
    Property Value
    Type Description
    ComboBoxVisualStyle

    Text

    Gets or sets the text associated with SfComboBox.

    Declaration
    public override string Text { get; set; }
    Property Value
    Type Description
    System.String

    TextBox

    Gets a TextBox that used to hold editor portion of the SfComboBox.

    Declaration
    public TextBox TextBox { get; }
    Property Value
    Type Description
    System.Windows.Forms.TextBox

    ToolTipOption

    Gets or sets the options for the tooltip to be displayed when hovering on the control.

    Declaration
    public ComboBoxToolTipOptions ToolTipOption { get; set; }
    Property Value
    Type Description
    ComboBoxToolTipOptions

    ValueMember

    Gets or sets the property to use as the actual value for the items in the SfComboBox

    Declaration
    public string ValueMember { get; set; }
    Property Value
    Type Description
    System.String

    Watermark

    Gets or sets water mark text to SfComboBox.

    Declaration
    public string Watermark { get; set; }
    Property Value
    Type Description
    System.String
    Remarks

    Watermark will be shown if AllowNull is enabled.

    Methods

    BeginInit()

    Signals the object that initialization is starting.

    Declaration
    public void BeginInit()

    BeginUpdate()

    Suspends the painting of the control until the EndUpdate() method is called.

    Declaration
    public void BeginUpdate()

    CreateAccessibilityInstance()

    Creates a new accessibility object in SfListView.

    Declaration
    protected override AccessibleObject CreateAccessibilityInstance()
    Returns
    Type Description
    System.Windows.Forms.AccessibleObject

    A new System.Windows.Forms.AccessibleObject for the SfComboBox, when AccessibilityEnabled is set as true

    Dispose(Boolean)

    Releases the unmanaged resources used by the Component and optionally releases the managed resources.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    EndInit()

    Signals the object that initialization is complete.

    Declaration
    public void EndInit()

    EndUpdate()

    Resumes the painting of the control suspended by calling the BeginUpdate() method.

    Declaration
    public void EndUpdate()

    GetControlName(String)

    Helps to apply the Control Name settings in control

    Declaration
    public override string GetControlName(string controlName)
    Parameters
    Type Name Description
    System.String controlName

    The control name.

    Returns
    Type Description
    System.String

    Returns the control name.

    Overrides
    BaseControl.GetControlName(String)

    HideDropDown()

    Occurs when drop down is hiding.

    Declaration
    public void HideDropDown()

    HideDropDown(PopupCloseAction)

    occurs when drop down is hiding

    Declaration
    public void HideDropDown(PopupCloseAction value)
    Parameters
    Type Name Description
    PopupCloseAction value

    popup close type

    InitLayout()

    Called after the control has been added to another container.

    Declaration
    protected override void InitLayout()

    IsInputChar(Char)

    Process the input key on SfComboBox

    Declaration
    protected override bool IsInputChar(char charCode)
    Parameters
    Type Name Description
    System.Char charCode

    The character input.

    Returns
    Type Description
    System.Boolean

    either true or false

    OnCanApplyThemeChanged(Boolean)

    Helps to apply the CanApplyTheme settings in control

    Declaration
    public override void OnCanApplyThemeChanged(bool canApplyTheme)
    Parameters
    Type Name Description
    System.Boolean canApplyTheme

    Specifies whether to apply the theme or not.

    Overrides
    BaseControl.OnCanApplyThemeChanged(Boolean)

    OnCanOverrideStyleChanged(Boolean)

    Helps to apply the CanOverrideStyle settings in control

    Declaration
    public override void OnCanOverrideStyleChanged(bool canOverrideStyle)
    Parameters
    Type Name Description
    System.Boolean canOverrideStyle

    Specifies whether to override the style or not.

    Overrides
    BaseControl.OnCanOverrideStyleChanged(Boolean)

    OnEnabledChanged(EventArgs)

    Occurs after the property of the SfComboBox changed.

    Declaration
    protected override void OnEnabledChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    A event data.

    OnGotFocus(EventArgs)

    Occurs when the control got focus.

    Declaration
    protected override void OnGotFocus(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    Event Args

    OnKeyDown(KeyEventArgs)

    Occues when key down on SfComboBox

    Declaration
    protected override void OnKeyDown(KeyEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.KeyEventArgs e

    A System.Windows.Forms.KeyEventArgs that contains the event data

    OnKeyPress(KeyPressEventArgs)

    Occurs when key press on SfComboBox

    Declaration
    protected override void OnKeyPress(KeyPressEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.KeyPressEventArgs e

    A System.Windows.Forms.KeyPressEventArgs that contains the event data

    OnLayout(LayoutEventArgs)

    To Update SfComboBox child Items Layout.

    Declaration
    protected override void OnLayout(LayoutEventArgs args)
    Parameters
    Type Name Description
    System.Windows.Forms.LayoutEventArgs args

    A System.Windows.Forms.LayoutEventArgs that contains the Layout event data.

    OnLostFocus(EventArgs)

    Occurs when the control loses focus.

    Declaration
    protected override void OnLostFocus(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    An System.EventArgs that contains event data.

    OnMouseDown(MouseEventArgs)

    Occurs when perform the mouse down operation.

    Declaration
    protected override void OnMouseDown(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e

    A System.Windows.Forms.MouseEventArgs contains event data.

    OnMouseEnter(EventArgs)

    Activates the mouse enter event for the control

    Declaration
    protected override void OnMouseEnter(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    Event args

    OnMouseLeave(EventArgs)

    Activates the mouse leave event for the control

    Declaration
    protected override void OnMouseLeave(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    Event args

    OnMouseMove(MouseEventArgs)

    Occurs on Mouse move

    Declaration
    protected override void OnMouseMove(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e

    Event argument

    OnMouseWheel(MouseEventArgs)

    Occurs while perform the mouse wheel operations.

    Declaration
    protected override void OnMouseWheel(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e

    A System.Windows.Forms.MouseEventArgs contains the event data.

    OnPaint(PaintEventArgs)

    Raises the Paint event.

    Declaration
    protected override void OnPaint(PaintEventArgs args)
    Parameters
    Type Name Description
    System.Windows.Forms.PaintEventArgs args

    A System.Windows.Forms.PaintEventArgs that contains the event data.

    OnRightToLeftChanged(EventArgs)

    Occurs when right to left property is changed

    Declaration
    protected override void OnRightToLeftChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    A System.EventArgs that contains the Layout event data.

    OnSizeChanged(EventArgs)

    Occurs while changing the control size.

    Declaration
    protected override void OnSizeChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    A event arguments.

    OnThemeNameChanged(String)

    Helps to apply the ThemeName settings in control

    Declaration
    public override void OnThemeNameChanged(string themeName)
    Parameters
    Type Name Description
    System.String themeName

    The theme name.

    Overrides
    BaseControl.OnThemeNameChanged(String)

    ProcessCmdKey(ref Message, Keys)

    Occurs when key process on SfComboBox

    Declaration
    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    Parameters
    Type Name Description
    System.Windows.Forms.Message msg

    message of key value

    System.Windows.Forms.Keys keyData

    One of the System.Windows.Forms.Keys values.

    Returns
    Type Description
    System.Boolean

    returns key value

    RaiseThemeChanged(Object, ThemeChangedEventArgs)

    Raises the ThemeNameChanged and ThemeChanged event when theme name changed.

    Declaration
    protected override void RaiseThemeChanged(object sender, ThemeChangedEventArgs args)
    Parameters
    Type Name Description
    System.Object sender

    The sender value.

    ThemeChangedEventArgs args

    A ThemeChangedEventArgs contains the event data.

    Overrides
    BaseControl.RaiseThemeChanged(Object, ThemeChangedEventArgs)

    ScaleControl(SizeF, BoundsSpecified)

    Scales a control's location, size, padding and margin.

    Declaration
    protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
    Parameters
    Type Name Description
    System.Drawing.SizeF factor

    The factor by which the height and width of the control will be scaled.

    System.Windows.Forms.BoundsSpecified specified

    A System.Windows.Forms.BoundsSpecified value that specifies the bounds of the control to use when defining its size and position.

    SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified)

    To set bounds of control

    Declaration
    protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
    Parameters
    Type Name Description
    System.Int32 x

    Specifies the x location of control

    System.Int32 y

    Specifies the y location of control

    System.Int32 width

    Specifies the width of the control

    System.Int32 height

    Specifies the height of the control

    System.Windows.Forms.BoundsSpecified specified

    Specifies the bounds of the control

    ShowDropDown()

    Occurs when drop down is opening

    Declaration
    public void ShowDropDown()

    Events

    DropDownClosed

    Occurs when the popup is closed.

    Declaration
    public event EventHandler<DropDownClosedEventArgs> DropDownClosed
    Event Type
    Type Description
    System.EventHandler<DropDownClosedEventArgs>

    DropDownClosing

    Occurs when the popup is about to be closed.

    Declaration
    public event EventHandler<DropDownClosingEventArgs> DropDownClosing
    Event Type
    Type Description
    System.EventHandler<DropDownClosingEventArgs>

    DropDownOpened

    occurs when drop down is opened.

    Declaration
    public event EventHandler DropDownOpened
    Event Type
    Type Description
    System.EventHandler

    DropDownOpening

    Occurs when the popup is about to be shown.

    Declaration
    public event EventHandler<DropDownOpeningEventArgs> DropDownOpening
    Event Type
    Type Description
    System.EventHandler<DropDownOpeningEventArgs>

    SelectedIndexChanged

    Occurs when selected index value is changed.

    Declaration
    public event EventHandler SelectedIndexChanged
    Event Type
    Type Description
    System.EventHandler

    SelectedValueChanged

    Occurs when selected value is changed.

    Declaration
    public event EventHandler SelectedValueChanged
    Event Type
    Type Description
    System.EventHandler

    ThemeChanged

    Occurs when theme name of the SfComboBox has changed.

    Declaration
    public event ThemeChangedEventHandler ThemeChanged
    Event Type
    Type Description
    ThemeChangedEventHandler

    ToolTipOpened

    Occurs while showing the tooltip for the control.

    Declaration
    public event EventHandler<ComboBoxToolTipOpenedEventArgs> ToolTipOpened
    Event Type
    Type Description
    System.EventHandler<ComboBoxToolTipOpenedEventArgs>

    ToolTipOpening

    Occurs while showing the tooltip for the control.

    Declaration
    public event EventHandler<ComboBoxToolTipOpeningEventArgs> ToolTipOpening
    Event Type
    Type Description
    System.EventHandler<ComboBoxToolTipOpeningEventArgs>

    Implements

    IThemeProvider
    IVisualStyle
    System.IDisposable
    System.ComponentModel.ISupportInitialize
    Back to top Generated by DocFX
    Copyright © 2001 - 2022 Syncfusion Inc. All Rights Reserved