We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Set Popup Width for Autocomplete

Hi,
I have followed the instructions below to programmatically set the width of the autocomplete popup.

https://www.syncfusion.com/kb/3604/how-to-programmatically-set-the-width-for-the-popup-in-the-autocomplete-control

Unfortunately, this only sets the size of the popup, and not the size of the control within the popup that is actually displaying the results.
I have attached an image to demonstrate this, but even your example exhibits the same problem, which is why the items are displayed in the centre of the popup!

Cheers,
James.

Attachment: ResizeNotWorking_b879765.zip

1 Reply

JP Jagadeesan Pichaimuthu Syncfusion Team March 26, 2019 11:16 AM UTC

Hi James, 
 
Thanks for using Syncfusion product. 
 
We have checked the reported problem in our end and you can resolve this issue by setting the width of the ListBox. Please refer the below code snippet below. 
 
void auto1_Loaded(object sender, RoutedEventArgs e) 
{ 
     Popup pop = AutoComplete1.Template.FindName("PART_Popup", AutoComplete1) as Popup; 
     ListBox listBox = AutoComplete1.Template.FindName("PART_Container", AutoComplete1) as ListBox; 
 
     if (pop != null) 
     { 
         pop.Width = 210; 
         listBox.Width = 200; 
     } 
} 
 
And also please find the screenshot and modified sample regarding it below: 
 
 
 
Let us know whether this helps also if you need any further assistance on this. 
 
Regards, 
Jagadeesan

Loader.
Live Chat Icon For mobile
Up arrow icon