示例#1
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            var foundUsers = SearchUser(txtSearch.Text);

            CurrentlyRetrievedUsers.Clear();
            if (foundUsers.Count() == 1)
            {
                PopulateSearchTextFields(foundUsers.First());
            }
            else if (foundUsers.Count() > 1)
            {
                foreach (var item in foundUsers)
                {
                    CurrentlyRetrievedUsers.Add(item);
                }
            }
        }
示例#2
0
 //ListBoxChanged is called when the collection is cleared(weird) .. remove listener and add it before calling clear
 public void PopulateSearchTextFields(User user)
 {
     CurrentlyRetrievedUsers.Clear();
     CurrentlyRetrievedUsers.Add(user);
     listBox.SelectedItem = user;
 }