English 中文(简体)
How can I eliminate the initial load time on the Silverlight Autocompletebox control?
原标题:

I have a Silverlight Autocompletebox to show a list of staff members, and it is working great. I get the data by loading a BusinessObjects list.

My problem is that the very first time you start typing something in the box, it takes close to 2 seconds to come back with suggestions. Afterwards, any subsequent searches seem almost instantaneous.

Obviously there must be some sort of lazy-loading happening here, it must somehow be configured to trigger on the initial use of the control.

I would like to somehow load the data when the control is first loaded, it would make for a better user experience if even on the first typing that the suggestions seem instant.

Does anyone know how I can do this?

最佳回答

Ok, after going back and forth on the Silverlight forum, got a great workaround that I though I would share. It was provided by a friendly Aussie named Matt, thought I would post it up here if people were curious.

Basically but setting the minimum search length to 2, you greatly reduce the processing and having the rendering "catch up" on the second and third characters. The other two attributes he suggests also help in speeding up the return.

Here is his post:

I updated my test project with your code and a much larger collection of items (100,000), and I started to see the issue ... :)

Setting the MinimumPrefixLength to 2 (or any value greater than 1. by default it is set to 1) and the MinimumPopulateDelay to 200 (by default it is set to 0) removed the issue for me. I d also recommend setting the MaxDropDownHeight, as this will ensure virtualization in the AutoCompleteBox will function correctly.

uxAuto.MinimumPrefixLength = 2;
uxAuto.MinimumPopulateDelay = 200;
uxAuto.MaxDropDownHeight = 300; 

Can you try this in your implementation and let me know how it goes? ...

Thanks. matt. Matthew Olney Senior Consultant - User Experience Avanade Australia

问题回答

I added a solution to this here which can limit the number of items getting loaded in the ACB and gives good performance for 200000 items.





相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签