Home Forums WinForms controls Xceed Grid for WinForms Creating an ComboxEditor Reply To: Creating an ComboxEditor

User (Old forums)
Member
Post count: 23064

There is probably an exception occurring that is swallowed by the grid or the .NET framework.  Is the debugger set to break on all exceptions? (Debug Menu -> Exceptions -> Common Language Runtime Exception, then select select the “Thrown” CheckBox).

Verify the “Enable Just My Code” CheckBox is unselected (Tools Menu -> Options -> Debugging -> General).

This will make sure that no exceptions are swallowed by the grid or the framework, and that the debugger will break in any part of the code, not just yours.

I have also made a small sample that works fine here when binding to a List<>, based on a class containing 2 properties (Value and Description).  Here is the code :

    private static List<CustomComboBoxItem> list;

    private static List<CustomComboBoxItem> list;

    private void Form1_Load( object sender, EventArgs e )
    {
      list = new List<CustomComboBoxItem>();

      for( int i = 0; i < 10; i++ )
      {
        list.Add( new CustomComboBoxItem( i, “item number ” + i.ToString() ) );
      }

      ComboBoxEditor editor = new ComboBoxEditor( list, “”, “Value”, “%Description%” );
      gridControl1.Columns[ 0 ].CellEditorManager = editor;
      ComboBoxViewer viewer = new ComboBoxViewer( list, “”, “Value”, “%Description%” );
      gridControl1.Columns[ 0 ].CellViewerManager = viewer;
    }

  public class CustomComboBoxItem
  {
    private int m_Value;
    private string m_Description;

    public CustomComboBoxItem( int value, string description )
    {
      m_Value = value;
      m_Description = description;
    }

    public int Value
    {
      get { return m_Value; }
      set { m_Value = value; }
    }

    public string Description
    {
      get { return m_Description; }
      set { m_Description = value; }
    }
  }

I suggest you try it, and then compare it to your own project to try to identify the differences, and hopefully the problem.  I have attached a sample project using this code to the post.

 

Imported from legacy forums. Posted by André (had 3391 views)