public void filter(FriendsCustomAdapter adapter, string constraint) { if (constraint != null && constraint.Length > 0) { ObservableCollection <UserItem> matchList = new ObservableCollection <UserItem>(); foreach (UserItem item in adapter.persons.ToList()) { if (item.Name.StartsWith(constraint.ToString())) { matchList.Add(item); } } adapter.persons = matchList; adapter.NotifyDataSetChanged(); } }
public FriendsFilter(FriendsCustomAdapter friendsCustomAdapter) { this.friendsCustomAdapter = friendsCustomAdapter; }