MulticolumnComboBox Auto Sizing

6 posts, 0 answers
  1. Khizar Khan
    Khizar Khan avatar
    41 posts
    Member since:
    Jan 2010

    Posted 26 Jan 2011 Link to this post

    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

  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 26 Jan 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Harsh Dara
    Harsh Dara avatar
    6 posts
    Member since:
    Jan 2010

    Posted 26 Jan 2011 Link to this post

    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();
            }

  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 26 Jan 2011 Link to this post

    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
  6. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 27 Jan 2011 Link to this post

    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.
  7. Harsh Dara
    Harsh Dara avatar
    6 posts
    Member since:
    Jan 2010

    Posted 31 Jan 2011 Link to this post

    Thanks a lot. That worked :)
Back to Top
UI for WinForms is Visual Studio 2017 Ready