- Add a RadMultiColumnComboBox and populate it with data.
- Hide most of the columns.
- Enable the AutoSizeDropDownToBestFit property
Note: the issue is reproducible with ControlDefault, Office2019Light, Desert. But it is NOT reproducible with Fluent
private void RadForm1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'nwindDataSet.Orders' table. You can move, or remove it, as needed.
this.ordersTableAdapter.Fill(this.nwindDataSet.Orders);
this.radMultiColumnComboBox1.DisplayMember = "OrderID";
this.radMultiColumnComboBox1.ValueMember = "OrderID";
this.radMultiColumnComboBox1.DataSource = ((DataSet)ordersBindingSource.DataSource).Tables[0].AsEnumerable().Reverse().Take(5);
this.radMultiColumnComboBox1.UseCompatibleTextRendering = false;
foreach (GridViewColumn col in this.radMultiColumnComboBox1.EditorControl.Columns)
{
if (!col.Name.Contains("ID") && !col.Name.Contains("OrderDate"))
{
col.IsVisible = false;
}
}
this.radMultiColumnComboBox1.AutoSizeDropDownColumnMode = BestFitColumnMode.AllCells;
this.radMultiColumnComboBox1.AutoSizeDropDownToBestFit = true;
return;
}
Expected result:
Actual result:
Workaround: instead of hiding the redundant columns, you can remove them:
List<string> columnNames = new List<string>();
foreach (GridViewColumn col in this.radMultiColumnComboBox1.EditorControl.Columns)
{
if (!col.Name.Contains("ID") && !col.Name.Contains("OrderDate"))
{
columnNames.Add(col.Name);
//col.IsVisible = false;
}
}
while (columnNames.Count>0)
{
this.radMultiColumnComboBox1.Columns.Remove(columnNames[0]);
columnNames.RemoveAt(0);
}