예제 #1
0
 private void Search(object sender, MouseButtonEventArgs e)
 {
     TextBox_Search.Visibility = Visibility.Visible;
     search_image.Visibility   = Visibility.Hidden;
     TextBox_Search.Text       = "";
     TextBox_Search.Focus();
 }
예제 #2
0
        private void TextBox_Search_TextChanged(object sender, TextChangedEventArgs e)
        {
            var           searchWords    = TextBox_Search.Text.Split(' ').ToList();
            List <Person> filteredPeople = new List <Person>(people);

            foreach (var word in searchWords)
            {
                filteredPeople = filteredPeople.Where(p => $"{p.Name} {p.LastName}".ToLower().Contains(word.ToLower())).ToList();
            }
            if (e.Changes.ElementAt(0).AddedLength > 0)
            {
            }
            ComboBox.IsDropDownOpen = true;
            ComboBox.ItemsSource    = filteredPeople;
            TextBox_Search.Focus();
        }
예제 #3
0
 private void ComboBox_DropDownClosed(object sender, EventArgs e)
 {
     TextBox_Search.TextChanged -= TextBox_Search_TextChanged;
     selectedPerson              = (Person)ComboBox.SelectedItem;
     if (selectedPerson != null)
     {
         if (PersonSelected != null)
         {
             PersonSelected(selectedPerson);
         }
         int age = DateTime.Now.Subtract(selectedPerson.DateOfBirth.GetValueOrDefault()).Days / 360;
         TextBox_Search.Text = $"{selectedPerson.Name} {selectedPerson.LastName}".Trim();
     }
     TextBox_Search.TextChanged += TextBox_Search_TextChanged;
     TextBox_Search.Focus();
 }
예제 #4
0
 private void SearchDialog_Load(object sender, EventArgs e)
 {
     TextBox_Search.Focus();
 }
예제 #5
0
 private void ComboBox_DropDownOpened(object sender, EventArgs e)
 {
     TextBox_Search.Focus();
 }