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

multicolumn combobox textChanged event

6 Answers 211 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Marius
Top achievements
Rank 1
Marius asked on 06 Jul 2012, 09:27 AM
Hello!
I upgraded the version of Telerik controls from v.2011.2.11.831 to v.2012.2.608.20. For the event TextChanged i have the following code:
private void RBCMultiColumnComboBox_TextChanged(object sender, EventArgs e)
{
    if (!this.IsDesignMode)
        if (string.IsNullOrEmpty(this.Text) && this.AutoFilter)
        {
            this.SelectedItem = null;
            this.SelectedValue = null;
            this.EditorControl.FilterDescriptors.Clear();
            this.NullText = string.Empty;
            FilterDescriptor filterDescriptor = new FilterDescriptor(this.DisplayMember, FilterOperator.Contains, string.Empty);
            this.EditorControl.FilterDescriptors.Add(filterDescriptor);
        }
}

The problem is that i am getting an stackOverflowException. Can you guide me for a possisble solution, please. Thank you!

6 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 09 Jul 2012, 01:13 PM
Hi Marius,

Thank you for writing.

I am pretty confident that the reason for adding this code was a work around for some issue and I think that it is safe to remove it.

Please give it a try and let me know how it behaves.
 
Kind regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Marius
Top achievements
Rank 1
answered on 11 Jul 2012, 02:18 PM
Hello!
Thank you for your answer. Now, my method looks like this:

private void RBCMultiColumnComboBox_TextChanged(object sender, EventArgs e)
{
        this.AutoFilter = true;
        FilterDescriptor filter = new FilterDescriptor();
        filter.PropertyName = this.DisplayMember;
        filter.Operator = FilterOperator.Contains;
        this.EditorControl.MasterTemplate.FilterDescriptors.Add(filter);
}


The problem is that when i insert text the width of the columns will increase. I created  a new project and it works with the same code. I have no idea where the difference is made. What should i check? Thank you!
0
Marius
Top achievements
Rank 1
answered on 12 Jul 2012, 08:10 AM
It seems that the following code causes this behaviour.
When i removed this line of code, the width of the columns will no longer increase. But i don't want to remove this code, because it is helping me to set the width of the combobox' elements equal to control's width.

this.radMultiColumnComboBox1.MultiColumnComboBoxElement.EditorControl.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
0
Stefan
Telerik team
answered on 16 Jul 2012, 07:00 AM
Hello Marius,

In general, this code should not be in the TextChanged event. You can place it in the Form.Load event so it will just add a filter descriptor once and the you just need to type the desired text in the editable area. More information here: http://www.telerik.com/help/winforms/multicolumncombobox-filtering.html.

In regards to the columns fill mode, the AutoSizeColumnsMode property will set the columns width on a way to fill the entire inner grid, so if you want this functionality you can keep it on. It should not increase the size of the columns. More information here: http://www.telerik.com/help/winforms/gridview-columns-resizing-columns-programatically.html.

Please try to move the code in the Form.Load and let me know how it works for you. If you continue having difficulties, you can always open a new support ticket and attach your project there so we can investigate it and provide you with adequate for your case support.
 
Regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Marius
Top achievements
Rank 1
answered on 16 Jul 2012, 08:13 AM
Hello!
Thank you for your answer.
I can not move the code in Form.Load event because i want to create a custom control who inherits the RadMultiColumnCombobox. I created a MyRadMultiColumnCombobox that derives from RadMultiColumnCombobox. Is there an event on this class where i can move this code?
0
Stefan
Telerik team
answered on 19 Jul 2012, 06:57 AM
Hi Marius,

Thank you for writing.

You can use the same event of the control for the desired purpose. Attached you can find a sample implementation.

Let me know if I can be of further assistance.
 
Greetings,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
MultiColumn ComboBox
Asked by
Marius
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Marius
Top achievements
Rank 1
Share this question
or