예제 #1
0
        void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
        {
            LibraryView.BeginRefresh();

            if (string.IsNullOrWhiteSpace(e.NewTextValue))
            {
                LibraryView.ItemsSource = App.Library.Songs;
            }
            else
            {
                LibraryView.ItemsSource = App.Library.Songs.Where(
                    s => s.Title.IndexOf(e.NewTextValue, StringComparison.OrdinalIgnoreCase) >= 0 ||
                    s.Artist.IndexOf(e.NewTextValue, StringComparison.OrdinalIgnoreCase) >= 0 ||
                    s.Album.IndexOf(e.NewTextValue, StringComparison.OrdinalIgnoreCase) >= 0
                    );
            }

            LibraryView.EndRefresh();
        }