Telerik RadControls for Windows Phone – Article #6 – RadAutoCompleteBox

RadAutoCompleteBox is a Autocomplete textbox that is part of the RadControls for Windows Phone . The RadAutoCompleteBox provides a textbox along with additional functionality of providing the suggestion based on the characters the user types in the textbox .

To add the RadAutoCompleteBox to your Windows Phone App , you need to include the following dll’s to your project

  • Telerik.Windows.Core.dll
  • Telerik.Windows.Controls.Input.dll

To add the RadAutoCompleteBox to your Windows Phone Page , you can add the following XAML code to your Windows Phone page

<telerikInput:RadAutoCompleteBox Height="79" Name="radAutoCompleteBox1" Text="TextBox" Width="414" />

If you want to add the RadAutoCompleteBox via Code behind , you can create and instance of RadAutoCompleteBox like the one below

RadAutoCompleteBox radAutoCompleteBox1 = new RadAutoCompleteBox();

You should also add the following namespace in your codebehind file

using Telerik.Windows.Controls;

Now comes the important aspect of the RadAutoCompleteBox – Providing Suggestion .

Once you have added the RadAutoCompleteBox to the Windows Phone Page , you need to set the SuggestionsSource property so that the related suggestions are displayed when the user enters the characters in the textbox .

private ListGetSuggestions()
{
   List MobilePhoneModel = new List();
   MobilePhoneModel.Add("HTC Mozart");
   MobilePhoneModel.Add("HTC HD7");
   MobilePhoneModel.Add("Nokia Lumia 800");
   MobilePhoneModel.Add("Nokia Lumia 710");
   MobilePhoneModel.Add("Nokia Lumia");
   return MobilePhoneModel;
}

radAutoCompleteBox1.SuggestionsSource = GetSuggestions();

 

Telerik RadControls for Windows Phone – Article #6 – RadAutoCompleteBox - 1

Telerik RadControls for Windows Phone – Article #6 – RadAutoCompleteBox – 1

No Responses

Leave a Reply