This question is locked. New answers and comments are not allowed.
Hi,
I'm following this Example http://blogs.telerik.com/ValeriHristov/Posts/08-12-04/Auto-complete_ComboBox_with_WCF_Service_and_RadControls_for_Silverlight.aspx and i have got it working up to getting results and filtering the only diffrence is i'm binding to a ObservableCollection of a Class not a string the only problem i'm having now is that when i start doing a search and getting results say Allen i get 3 Allens when there is only one appering in the Drop down no idea why i have looking it over and over here is the XAML
and the WebService
And Data Source
Please Help
I'm following this Example http://blogs.telerik.com/ValeriHristov/Posts/08-12-04/Auto-complete_ComboBox_with_WCF_Service_and_RadControls_for_Silverlight.aspx and i have got it working up to getting results and filtering the only diffrence is i'm binding to a ObservableCollection of a Class not a string the only problem i'm having now is that when i start doing a search and getting results say Allen i get 3 Allens when there is only one appering in the Drop down no idea why i have looking it over and over here is the XAML
| <telerikInput:RadComboBox x:Name="ddlUsers" GotFocus="ddlUsers_GotFocus" DisplayMemberPath="Username" |
| ItemsSource="{Binding Users}" Text="{Binding Text, Mode=TwoWay}" |
| IsTextSearchEnabled="False" IsEditable="True" HorizontalAlignment="Left" Margin="24,23,0,8" Width="155"/> |
and the WebService
| private static UserEOList Users |
| { |
| get |
| { |
| UserEOList user = HostingEnvironment.Cache["Service.Users"] as UserEOList; |
| if(user == null) |
| { |
| var userList = new UserEOList(); |
| userList.Load(); |
| HostingEnvironment.Cache["Service.Users"] = userList; |
| } |
| return user; |
| } |
| } |
| [OperationContract] |
| public List<UserEO> SearchUsers(string prefix) |
| { |
| bool empty = string.IsNullOrEmpty(prefix); |
| return (from a in Users |
| where empty || a.Username.ToLower().StartsWith(prefix.ToLower()) |
| orderby a.Username |
| select a).Take(10).ToList(); |
| } |
And Data Source
| public string Text |
| { |
| get { return text; } |
| set |
| { |
| if (text != value) |
| { |
| text = value; |
| OnPropertyChanged("Text"); |
| getUsers(); |
| } |
| } |
| } |
| private void getUsers() |
| { |
| service.SearchUsersAsync(Text); |
| } |
| private void service_SearchUsersCompleted(object sender, SearchUsersCompletedEventArgs e) |
| { |
| if (e.Error == null) |
| { |
| var empty = string.IsNullOrEmpty(Text); |
| for (var i = Users.Count - 1; i >= 0; i--) |
| { |
| if (empty || !Users[i].Username.ToLower().Contains(Text.ToLower())) |
| { |
| Users.RemoveAt(i); |
| } |
| } |
| foreach (var user in e.Result) |
| { |
| if (!Users.Contains(user)) |
| Users.Add(user); |
| } |
| } |
| } |
Please Help