RadAutoCompleteBox with Telerik RadControls for Windows Phone
Join the DZone community and get the full member experience.
Join For FreeRadAutoCompleteBox is an Autocomplete textbox that is part of the RadControls for Windows Phone. The RadAutoCompleteBox provides a textbox along with the 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 Suggestions.
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();
Published at DZone with permission of Senthil Kumar, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments