This is a migrated thread and some comments may be shown as answers.
RadAutoCompleteBox dropdown menu resizes as you scroll.
3 Answers 44 Views
This is a migrated thread and some comments may be shown as answers.
Ivo
Top achievements
Rank 1
Ivo asked on 15 Nov 2016, 11:19 AM

It is possible to set the width of the drop down menu to the width of the widest item in the list?

Currently when you scroll the drop down menu resizes automatically if DropDownWidth is set to Auto.

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 17 Nov 2016, 09:14 AM
Hello Ivo,

The observed by you behavior is an expected one. When you open the DropDown only the visible items are loaded into the visual tree. So, when the DropDownWidth is set to Auto it takes the width only of that visible items. When you began to scroll the other items are loaded into the visual tree. Because of that when an item with bigger width is loaded the DropDownWidth changes. 

What we could suggest you for your concrete scenario is instead of setting it to auto to measure the width of the filtered items and set the biggest one to the DropDownWidth property. For example you could handle the SearchTextChanged event and inside it to find the widest item from the FilteredItems collections and set the DropDownWidth as needed.

Please, check the attached sample that demonstrates that approach.

Hope this helps.

Regards,
Nasko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Ivo
Top achievements
Rank 1
answered on 30 Nov 2016, 08:25 AM

Hi Nasko,

Thank you very much. This work as expected. The measure doesn't take into account the vertical scrollbar so the longest items are still cut off. Is there a way to reliably measure the width of the scrollbar and include it in the calculation?

0
Nasko
Telerik team
answered on 30 Nov 2016, 01:20 PM
Hello Ivo,

Please, check the attached sample that demonstrates how to get the Width of the vertical ScrollBar and include it into the measure. Notice that you might need to add some additional pixels in the ActualWidth in order to adjust it as desired.

Hope this helps.

Regards,
Nasko
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Asked by
Ivo
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Ivo
Top achievements
Rank 1
Share this question
or