Home Forums WinForms controls Xceed Grid for WinForms ComboBox example when used in unbound grid

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17414 |

    Could you please provide a simple example of how to use a combobox in an unbound grid? Just something very simple so I can complete my evaluation of Exceed grid without spending another hour scouring weak documentation and piles of databound examples (which is getting XcEEDINGLY annoying…. and here I thought components were developed to save us time).  

    Imported from legacy forums. Posted by David (had 1330 views)

    Xceed Support
    Member
    Post count: 5658

    Hi David,

     

    Please find next an example for your scenario:

     

    GridControl gridControl = new GridControl();
          gridControl.FixedHeaderRows.Add( new ColumnManagerRow() );

          gridControl.Dock = DockStyle.Fill;

          Column column1 = new Column( “Column1”, typeof( string ) );

          gridControl.Columns.Add( column1 );
          gridControl.DataRowTemplate.FitHeightToEditors = true;

          this.Controls.Add( gridControl );

          for( int i = 0; i < 10; i++ )
          {
            Xceed.Grid.DataRow dataRow = gridControl.DataRows.AddNew();

            dataRow.Cells[ 0 ].Value = “Test #1”;

            dataRow.EndEdit();
          }

          WinComboBox templateComboBox = new WinComboBox();
          templateComboBox.Items.Add( “Test #1” );
          templateComboBox.Items.Add( “Test #2” );
          templateComboBox.Items.Add( “Test #3” );
          templateComboBox.Items.Add( “Test #4” );
          templateComboBox.Items.Add( “Test #5” );

          ComboBoxEditor comboEditor = new ComboBoxEditor( templateComboBox );

          column1.CellEditorManager = comboEditor;

     

    You should also handle the SettingControlValueCore event and chose the default value on your comboBox if the cell’s value does not match any of its items.

    Imported from legacy forums. Posted by Mohamed [Xceed] (had 357 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for the prompt reply. I think I have this working properly now.

    Imported from legacy forums. Posted by David (had 1304 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.