RadMultiColumnComboBox - Fix inner TextField width

1 Answer 17 Views
MultiColumnComboBox
Shawn
Top achievements
Rank 1
Iron
Shawn asked on 13 Mar 2025, 05:11 PM

There's an issue with the RadMultiColumnComboBox in that the inner text field is left aligned so if the user doesn't click exactly in the text box, then they can't type anything.

In the attached image, I set the border of the inner textbox to red just for a visual aid. If the user clicks anywhere inside the red border, then the field gets focus and they can type and everything works as expected. However, if they're not focused on that field and they try to click to the right of the red border, it does nothing and to the user, it feels buggy.

I tried setting the horizontal alignment of the text box to stretch, but that had no effect. Is there a fix for this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Shawn
Top achievements
Rank 1
Iron
answered on 13 Mar 2025, 05:14 PM

I fixed this by adding a binding on the inner text box. Not sure if there's a better way but this seems to have worked.

private void MultiColumnComboBox_Loaded(object sender, RoutedEventArgs e)
{
    var textBox = MultiColumnComboBox.FindChildByType<TextBox>();

    if (textBox != null)
    {
        textBox.SetBinding(WidthProperty, new Binding(nameof(ActualWidth)) { Source = MultiColumnComboBox });
    }
}

Martin Ivanov
Telerik team
commented on 18 Mar 2025, 03:32 PM

In general, this solution will work, but it may not be very suitable after you make a selection and if the selection boxes are enabled (which is by default). In that case, the textbox will be aligned next to the selection boxes. What you can try to improve this a bit is to manually re-calculate and update the Width of the TextBox element also on selection changed.
Tags
MultiColumnComboBox
Asked by
Shawn
Top achievements
Rank 1
Iron
Answers by
Shawn
Top achievements
Rank 1
Iron
Share this question
or