Xceed Grid for WinForms v4.3 Documentation
Welcome to Xceed Grid for WinForms v4.3 / Basic Concepts / Editor Controls / WinComboBox control / WinComboBox DropDown control

In This Topic
    WinComboBox DropDown control
    In This Topic

    The WinComboBox control uses a GridControl as its dropdown control. This GridControl control can be accessed via the DropDownControl property. Unlike the other editors/controls (with the exception of the WinDatePicker and WinNumericTextBox controls), the combobox's dropdown cannot be replaced with another control.

    Dropdown control

    One of the advantages of using the GridControl class as the WinComboBox's dropdown is that the dropdown can be configured to act like a grid. For example, if you add a row to the dropdown control's FixedHeaderRows collection, you end up with a dropdown control that has a header which can be used to sort the items in the dropdown and display the column names (ColumnManagerRow). 

    VB.NET
    Copy Code
    Dim combo As New WinComboBox() 
    combo.Columns.Add( New ColumnInfo( "Country", GetType( String ) ) )
    combo.Columns.Add( New ColumnInfo( "Population", GetType( Integer ) ) )      
    combo.Columns.Add( New ColumnInfo( "City", GetType( String ) ) )
    combo.Columns.Add( New ColumnInfo( "AverageTemp", GetType( String ) ) )      
    
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "Canada", 31500000, "Ottawa", "12.2 ºc" } ) )
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "Switzerland", 7300000, "Bern", "23.3 ºc" } ) )
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "France", 59500000, "Paris", "27.3 ºc" } ) )
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "USA", 278000000, "Washington", "14.1 ºc" } ) )
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "UK", 59700000, "London", "23.7 ºc" } ) )
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "Belgium", 10300000, "Brussels", "21.8 ºc" } ) )
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "Italy", 57700000, "Rome", "29.6 ºc" } ) )
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "Spain", 40000000, "Madrid", "31.8 ºc" } ) )
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "Germany", 83000000, "Berlin", "25.1 ºc" } ) )
    combo.Items.Add( New ComboBoxItem( New Object( 3 ){ "Japan", 126800000, "Tokyo", "17.2 ºc" } ) ) 
    combo.DropDownControl.FixedHeaderRows.Add( New Xceed.Grid.ColumnManagerRow() ) 
    combo.Location = New Point( 10, 10 )
    Me.Controls.Add( combo )  
    C#
    Copy Code
    WinComboBox combo = new WinComboBox();
    combo.Columns.Add( new ColumnInfo( "Country", typeof( string ) ) );
    combo.Columns.Add( new ColumnInfo( "Population", typeof( int ) ) );      
    combo.Columns.Add( new ColumnInfo( "City", typeof( string ) ) );
    combo.Columns.Add( new ColumnInfo( "AverageTemp", typeof( string ) ) );     
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "Canada", 31500000, "Ottawa", "12.2 ºc" } ) );
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "Switzerland", 7300000, "Bern", "23.3 ºc" } ) );
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "France", 59500000, "Paris", "27.3 ºc" } ) );
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "USA", 278000000, "Washington", "14.1 ºc" } ) );
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "UK", 59700000, "London", "23.7 ºc" } ) );
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "Belgium", 10300000, "Brussels", "21.8 c" } ) );
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "Italy", 57700000, "Rome", "29.6 ºc" } ) );
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "Spain", 40000000, "Madrid", "31.8 ºc" } ) );
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "Germany", 83000000, "Berlin", "25.1 ºc" } ));
    combo.Items.Add( new ComboBoxItem( new object[ 4 ]{ "Japan", 126800000, "Tokyo", "17.2 ºc" } ) );
    combo.DropDownControl.FixedHeaderRows.Add( new Xceed.Grid.ColumnManagerRow() );
    combo.Location = new Point( 10, 10 );
    this.Controls.Add( combo );