Telerik UI for Windows Phone by Progress

RadAutoCompleteBox provides infrastrucure for using web services as providers for filtered suggestions. This is done via a specialized Auto Complete Provider - the WebServiceAutoCompleteProvider class. This class allows the developer to receive information when the input in the control changes. At this point a data request to any type of service can be made and when the data is available - a special method exposed by RadAutoCompleteBox can be used to load the information and display the filtered suggestions.

Initializing and using the WebServiceAutoCompleteProvider

To activate the web service support in RadAutoCompleteBox you should first create an instance of the WebServiceAutoCompleteProvider class and pass it to RadAutoCompleteBox to use it for providing filtered suggestions. The following code snippet demonstrates how this is done:

CopyC#
public MainPage()
{
    InitializeComponent();
    WebServiceAutoCompleteProvider webServiceProvider = new WebServiceAutoCompleteProvider();
    this.autoCompleteBox.InitSuggestionsProvider(this.webServiceProvider);
}

After the autocomplete provider has been initialized with RadAutoCompleteBox we need to handle the InputChanged event and perform the request to the service that will later provide the filtered suggestions:

CopyC#
this.webServiceProvider.InputChanged += this.OnWebServiceProvider_InputChanged;

private void OnWebServiceProvider_InputChanged(object sender, EventArgs e)
{
    // Perform the data request to the remote auto-complete service
}

After the remote data is delivered the LoadSuggestions method exposed by the WebService autocomplete provider should be called in order to load the available suggestions:

CopyC#
private void OnDataDelivered(IEnumerable items)
{
    this.webServiceProvider.LoadSuggestions(items)
}

Calling the LoadSuggestions method will trigger the internal RadAutoCompleteLogic that opens the suggestions popup and displays the available items.

See Also