public void UpdateFilteredContacts(IList <Contact> contactList) { FilteredContacts.Clear(); foreach (var x in contactList) { FilteredContacts.Add(x); } }
private void CallToSelectedContact() { var contact = FilteredContacts.FirstOrDefault(x => x.IsSelected); if (contact != null) { StartCall(contact); } }
protected void FilterContacts() { FilteredContacts.Clear(); var filteredContact = _allContacts.Where(x => x.ContactName.ToLower() .Contains(!String.IsNullOrEmpty(SearchContactText) ? SearchContactText.ToLower() : "")).ToList(); foreach (var contact in filteredContact) { FilteredContacts.Add(contact); } }
private void DataGridDoubleClickAction(MouseButtonEventArgs e) { TextBlock source = e.OriginalSource as TextBlock; if (source == null) { return; } string column = source.Text; if (column == "Column Name" || column == "Score") { return; } SynchronizedObservableCollection <Contact> contacts = ContactsManager.Current.ContactsCache; FilteredContacts.Clear(); for (int i = 0; i < contacts.Count; i++) { Contact contact = contacts.ElementAt(i); // Get value of specified column string fieldValue = contact.GetType().GetProperty(column).GetValue(contact, null) as string; if (CellsOption == 0) { if (!string.IsNullOrEmpty(fieldValue)) { FilteredContacts.Add(contact); } } else { if (string.IsNullOrEmpty(fieldValue)) { FilteredContacts.Add(contact); } } } DataTabItemVisibility = Visibility.Visible; DataTabControlSelectedTab = 1; }