DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > Using Custom Objects in RadAutoCompleteBox for Windows Phone

Using Custom Objects in RadAutoCompleteBox for Windows Phone

Senthil Kumar user avatar by
Senthil Kumar
·
Apr. 26, 12 · Mobile Zone · Interview
Like (0)
Save
Tweet
4.91K Views

Join the DZone community and get the full member experience.

Join For Free

In one of my earlier blog posts, I talked about RadAutoCompleteBox showing how to display suggestions using a List of strings.

I had a requirement to bind custom objects to the Suggestion List to the RadAutoCompleteBox and it took the help of the Telerik Support Team to get it done.

To put it simply, Telerik’s Support Team is super .

To bind the Custom Business Objects , you should follow 3 steps

1. Set the SuggestionsSource to the List of Custom Objects

2. Set the FilterKeyPath

3. Create SuggestionItemTemplate and DataTemplate and bind the property that should be displayed as a suggestion.

Below is a sample sourcecode that uses Custom Objects to display Suggestion.

<telerikInput:RadAutoCompleteBox Height="70" HorizontalAlignment="Left" Margin="17,31,0,0" Name="radAutoCompleteBox1" Text=""
VerticalAlignment="Top" Width="429" FilterKeyPath="Name"  >
<telerikInput:RadAutoCompleteBox.SuggestionItemTemplate>
<DataTemplate>                   �
<TextBlock Text="{Binding Name}"/>               �
</DataTemplate>               �
</telerikInput:RadAutoCompleteBox.SuggestionItemTemplate>           �
</telerikInput:RadAutoCompleteBox>
public partial class MainPage : PhoneApplicationPage   �
{       �
// Constructor       �
public MainPage()       �
{           �
InitializeComponent();           �
radAutoCompleteBox1.SuggestionsSource = Data.GetSuggestions();       �
}    �
}   �
public class Employee   �
{       �
public string Name       �
{           �
get;           �
set;       �
}

public string ID       �
{           �
get;           �
set;       �
}

}   �
public static class Data   �
{       �
public static List<Employee> GetSuggestions()       �
{           �
List<Employee> Names = new List<Employee>();           �
Names.Add(new Employee { Name = "Vijay", ID = "1" });           �
Names.Add(new Employee { Name = "Senthil", ID = "2" });           �
Names.Add(new Employee { Name = "Surya", ID = "3" });           �
Names.Add(new Employee { Name = "Norton", ID = "4" });           �
Names.Add(new Employee { Name = "Sandy", ID = "5" });           �
Names.Add(new Employee { Name = "Saravan", ID = "6" });           �
Names.Add(new Employee { Name = "Sunil", ID = "7" });           �
 return Names;       �
}   �
}



 

Object (computer science) Windows Phone

Published at DZone with permission of Senthil Kumar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How to Classify NSFW (Not Safe for Work) Imagery with AI Content Moderation using Java
  • What I Miss in Java, the Perspective of a Kotlin Developer
  • Python Class Attribute: Class Attribute vs. Instance Attribute
  • Blocking Ads on Your Network Using Raspberry Pi 3 + Fedora + Pi-hole

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo