private void SearchButton_Click(object sender, RoutedEventArgs e) { var text = KeywordTextBox.Text; var keywords = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); var list = new List <string>(); for (var i = 0; i < keywords.Length; i++) { list.Add(keywords[i].Replace(" ", string.Empty)); } var exercises = ExerciseManager.Filter(list); ExerciseListBox.ItemsSource = exercises; }