This is a migrated thread and some comments may be shown as answers.

MulticolumnComboBox Auto Sizing

5 Answers 266 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Khizar Khan
Top achievements
Rank 1
Khizar Khan asked on 26 Jan 2011, 01:49 PM
Hi,

I have a multicolumn combobox. on the first time click of the combobox the sizing is not correct, it doesn't render itself properly and all the details are not visible.

but when you type some search text in auto filter text box, it does auto size it properly and all the text is visible.

please have a look @ screen shot attached.

regards,
Khizar

5 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 26 Jan 2011, 02:08 PM
Hello,

You can get to the Grid section of the Combo via the editor control. In this way, you can call teh BestFitColumns method as below

AddHandler Me.RadMultiColumnComboBox1.DropDownOpened, AddressOf RadMultiColumnComboBox1_DropDownOpened
Private Sub RadMultiColumnComboBox1_DropDownOpened(ByVal sender As Object, ByVal e As EventArgs)
    Me.RadMultiColumnComboBox1.EditorControl.BestFitColumns()
End Sub

Hope that helps but let me knw if you have further questions
Richard
0
Harsh Dara
Top achievements
Rank 1
answered on 26 Jan 2011, 03:36 PM
We have done that but itdoesnt solve the problem with the sizing.

I have given the code below for your reference:

this.rComboBoxImInvoiceTypes.AutoSizeDropDownToBestFit = true;
this.rComboBoxImInvoiceTypes.DataSource = InvoiceTypes;
this.rComboBoxImInvoiceTypes.DropDownOpened += new EventHandler(rComboBoxImInvoiceTypes_DropDownOpened);                FilterDescriptor filter = new FilterDescriptor();
filter.PropertyName = this.rComboBoxImInvoiceTypes.DisplayMember;
filter.Operator = FilterOperator.StartsWith;
this.rComboBoxImInvoiceTypes.EditorControl.MasterTemplate.FilterDescriptors.Add(filter);
this.rComboBoxImInvoiceTypes.EditorControl.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
this.rComboBoxImInvoiceTypes.AutoFilter = true;
this.rComboBoxImInvoiceTypes.MultiColumnComboBoxElement.AutoCompleteMode = AutoCompleteMode.Suggest;
this.rComboBoxImInvoiceTypes.DropDownStyle = RadDropDownStyle.DropDown;           

       void rComboBoxImInvoiceTypes_DropDownOpened(object sender, EventArgs e)
        {
            this.rComboBoxImInvoiceTypes.EditorControl.BestFitColumns();
        }

0
Richard Slade
Top achievements
Rank 2
answered on 26 Jan 2011, 04:11 PM
Hello Harsh,

I would suggest setting a min size for the table element of the internal grid.
this.rComboBoxImInvoiceTypes.EditorControl.TableElement.MinSize = new Size(300, 200);

hope that helps, but let me know if you need further information
Richard
0
Jack
Telerik team
answered on 27 Jan 2011, 12:12 PM
Hi Khizar Khan,

When the AutoSizeDropDownToBestFit property is set to true you do not have to set the AutoSizeColumnsMode to Fill and call the BestFitColumns method. I slightly modified your code and was not able to observe the issue:
rComboBoxImInvoiceTypes.AutoSizeDropDownToBestFit = true;
rComboBoxImInvoiceTypes.DataSource = InvoiceTypes;
FilterDescriptor filter = new FilterDescriptor();
filter.PropertyName = "Value";
filter.Operator = FilterOperator.IsGreaterThan;
rComboBoxImInvoiceTypes.EditorControl.MasterTemplate.FilterDescriptors.Add(filter);
rComboBoxImInvoiceTypes.AutoFilter = true;
rComboBoxImInvoiceTypes.MultiColumnComboBoxElement.AutoCompleteMode = AutoCompleteMode.Suggest;
rComboBoxImInvoiceTypes.DropDownStyle = RadDropDownStyle.DropDown;

Could you please confirm that this solves the issue? If not, send me your application and I will try to find the best option.

I am looking forward to your reply.

All the best,
Jack
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
0
Harsh Dara
Top achievements
Rank 1
answered on 31 Jan 2011, 04:10 PM
Thanks a lot. That worked :)
Tags
MultiColumn ComboBox
Asked by
Khizar Khan
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Harsh Dara
Top achievements
Rank 1
Jack
Telerik team
Share this question
or