Exemple #1
0
 //поиск людей
 private void searchDataTypeCB_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     searchData.Clear();
     searchData.Text           = "Введите ключевое слово";
     searchData.Foreground     = SpecialColor.placeholder();
     resultsPeople.ItemsSource = null;
     resultsPeople.ItemsSource = loadResultsPeople;
 }
Exemple #2
0
 private void searchData_TextChanged(object sender, TextChangedEventArgs e)
 {
     newSearchMass.Clear();
     if (searchData.Text != "" && searchData.Text != "Введите ключевое слово")
     {
         if (searchDataTypeCB.Text == "всем полям")
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.lastName.ToLower().Contains(searchData.Text.ToLower()) || person.firstName.ToLower().Contains(searchData.Text.ToLower()) || person.secondName.ToLower().Contains(searchData.Text.ToLower()) || person.group.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         else if (searchDataTypeCB.Text == "фамилии")
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.lastName.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         else if (searchDataTypeCB.Text == "имени")
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.firstName.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         else if (searchDataTypeCB.Text == "отчеству")
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.secondName.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         else
         {
             foreach (Person person in loadResultsPeople)
             {
                 if (person.group.ToLower().Contains(searchData.Text.ToLower()))
                 {
                     newSearchMass.Add(person);
                 }
             }
         }
         resultsPeople.ItemsSource = null;
         resultsPeople.ItemsSource = newSearchMass;
     }
     else
     {
         if (searchData.Text != "Введите ключевое слово" || searchData.Foreground == SpecialColor.placeholder())
         {
             resultsPeople.ItemsSource = null;
             resultsPeople.ItemsSource = loadResultsPeople;
         }
     }
     //if (resultsPeople.Items.Count!=0)
     //    loadDataTypeCB_SelectionChanged(null, null);
 }