示例#1
0
 //Search the Library for the Books by Author Name
 //and display the results in the DataGrid
 private void AuthorSearch(object sender, TextChangedEventArgs e)
 {
     //If we are in Regular Search Mode
     if (!IsMultiSearch)
     {
         //Search for the books by Author Name
         //and display the results in the DataGrid
         dataLib.ItemsSource =
             mainLibrary.FindBook(b => b.Author.ToLower().Contains(txtAuthor.Text.ToLower()));
     }
     //If User inputs white spaces in the Search by Author TextBox -
     //Show all the Items in the Library
     if (string.IsNullOrWhiteSpace(txtAuthor.Text))
     {
         RefreshDataGrid();
     }
 }