/// /// <summary> Event handler. Called by TxtSearch for text changed events. /// Searches for the appropriate patients and displays them in a list.</summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> /// private void TxtSearch_TextChanged(object sender, TextChangedEventArgs e) { patientList = SearchPatientPage.FilterPatients(txtSearch.Text); //Patients to search if (lstSearchResults != null) { lstSearchResults.Items.Clear(); //Clear results scrollList.Height = 0; } int colourController = 0; foreach (Demographics.Patient p in patientList) { Label l = new Label();//List patients in format l.Content = String.Format("{0} {1}, {2}, {3}", p.FirstName, p.LastName, p.HCN, p.GetAddress()); l.FontSize = 15; if (colourController % 2 == 0)//Colour opposite lines { l.Background = Brushes.White; } else { l.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); } colourController++; scrollList.Height += l.Height; lstSearchResults.Items.Add(l); //Add the items l.PreviewMouseDown += new MouseButtonEventHandler(SearchItem_PreviewMouseDown); } }
private void ExitSearch(Demographics.Patient selectedItem) { Grid holder = (Grid)this.Parent; Patients.SearchPatientPage parent = (Patients.SearchPatientPage)holder.Parent; parent.ReturnPatient(selectedItem); }