void Entry_TextChanged(object sender, TextChangedEventArgs e) { var oldText = e.OldTextValue; var newText = e.NewTextValue; List <HymnTableInfo> hymnList = new List <HymnTableInfo>(); foreach (var page in DivideSong) { if (page.Key.IndexOf(newText) != -1) { HymnTableInfo table = new HymnTableInfo(); table.Id = Convert.ToInt16(page.Key); table.Name = page.Value; hymnList.Add(table); continue; } if (page.Value.IndexOf(newText) != -1) { HymnTableInfo table = new HymnTableInfo(); table.Id = Convert.ToInt16(page.Key); table.Name = page.Value; hymnList.Add(table); continue; } } listView.ItemsSource = hymnList; }
public Hymn() { InitializeComponent(); List <HymnTableInfo> hymnList = new List <HymnTableInfo>(); foreach (var page in DivideSong) { HymnTableInfo table = new HymnTableInfo(); table.Id = Convert.ToInt16(page.Key); table.Name = page.Value; hymnList.Add(table); } listView.ItemsSource = hymnList; }