Home Forums WinForms controls Xceed Grid for WinForms Combobox confusion

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

    I’m trying to set up a combobox column in a grid. The column is bound to a numeric column. I want it to display text at all times, however. What’s happening is that the combo box will display my text correctly when dropped down, but when I leave the cell, it reverts back to displaying the number. I suspect this is because I don’t know how to use the CellEditorManager vs CellViewerManager. I tried playing with different settings, but just got more lost.

    One other annoyance is that when the combo box is dropped down and displaying my text values, it also displays the bound number unexpectedly off to the right. I don’t want this. I want to see text only. I thought this was controlled by the DisplayFormat property, which I’ve set to %Name%. Still it displays the text and the number.

    Imported from legacy forums. Posted by Adam (had 645 views)

    User (Old forums)
    Member
    Post count: 23064

    If the column is a string, you only need to set the CellEditorManager, but when it is a numeric one, you need to also set the CellViewerManager.

    e.g.:

    WinComboBox box = new WinComboBox(northwindDataSet, “Suppliers”, “SupplierID”, “%CompanyName%” );

    ComboBoxEditor cboEditor = new ComboBoxEditor( box );

    ComboBoxViewer cboViewer = new ComboBoxViewer( box );

    gridControl1.Columns[

    “SupplierID” ].CellEditorManager = cboEditor;

    gridControl1.Columns[

    “SupplierID” ].CellViewerManager = cboViewer;

     

    The DisplayFormat property is for the TextBox portion of the ComboBox.  To change the dropdown display, you need to set the visible property to false for each column you don’t want to display.

    e.g.:

    foreach( ColumnInfo col in cboEditor.TemplateControl.Columns )

    {

        if( col.Name != “CompanyName” )

        {

            col.Visible =

    false;

        }

    }

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

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