Last Updated: 26 Jun 2015 11:08 by ADMIN
Dess | Tech Support Engineer, Principal
Created on: 24 Nov 2014 07:13
Category: GridView
Type: Bug Report
FIX. RadGridView - RadMultiColumnComboBoxElement does not always bestfit the columns when the AutoSizeDropDownToBestFit is set to true
To reproduce:

1. Add a RadGridView with two GridViewMultiComboBoxColumns at design time.
2. Bind both of the columns at design time to two different data sources.
3. In the CellEditorInitialized event, set the RadMultiColumnComboBoxElement.AutoSizeDropDownToBestFit property to true.
4. Run the application and open the editor for one of the GridViewMultiComboBoxColumns . You will notice that the columns are automatically sized to fit the content. However, if you open the editor for the other GridViewMultiComboBoxColumn, you will see that columns are not auto sized correctly.  Please refer to the attached gif file.

private void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
    RadMultiColumnComboBoxElement mccbEditor = e.ActiveEditor as RadMultiColumnComboBoxElement;
    if (mccbEditor != null)
        mccbEditor.AutoSizeDropDownToBestFit = true;
        mccbEditor.PopupOpening -= mccbEditor_PopupOpening;
        mccbEditor.PopupOpening += mccbEditor_PopupOpening;

private void mccbEditor_PopupOpening(object sender, CancelEventArgs e)
    RadMultiColumnComboBoxElement mccbEditor = sender as RadMultiColumnComboBoxElement;
    if (mccbEditor != null)
        int width = 0;
        foreach (GridViewColumn c in mccbEditor.EditorControl.Columns)
            width += c.Width;
        width += mccbEditor.EditorControl.TableElement.VScrollBar.Size.Width;
        mccbEditor.MultiColumnPopupForm.Size = new Size(width, mccbEditor.MultiColumnPopupForm.Size.Height);
Attached Files: