multicolumn combobox textChanged event

7 posts, 0 answers
  1. Marius
    Marius avatar
    16 posts
    Member since:
    Oct 2011

    Posted 06 Jul 2012 Link to this post

    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!
  2. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 09 Jul 2012 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Marius
    Marius avatar
    16 posts
    Member since:
    Oct 2011

    Posted 11 Jul 2012 Link to this post

    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!
  5. Marius
    Marius avatar
    16 posts
    Member since:
    Oct 2011

    Posted 12 Jul 2012 Link to this post

    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;
  6. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 16 Jul 2012 Link to this post

    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 >>
  7. Marius
    Marius avatar
    16 posts
    Member since:
    Oct 2011

    Posted 16 Jul 2012 Link to this post

    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?
  8. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 19 Jul 2012 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready