public void SearchTile(string name) { foreach (KeyValuePair <string, Tile> entry in tileMap) { if (entry.Key.IndexOf(name, 0, StringComparison.InvariantCultureIgnoreCase) > -1) { SearchEntry se = new SearchEntry(); se.Name = entry.Key; se.Source = entry.Value.Image.Source as BitmapImage; SearchResultList.Items.Add(se); } } }
public void SearchBlocks(string name) { foreach (KeyValuePair <BlockName, BitmapImage> entry in blockMap) { if (entry.Key.ToString().IndexOf(name, 0, StringComparison.InvariantCultureIgnoreCase) > -1) { SearchEntry se = new SearchEntry(); se.Name = entry.Key.ToString(); se.Source = entry.Value; se.type = TileType.Foreground; SearchResultList.Items.Add(se); } } }
private void SearchEntry_MouseDown(object sender, MouseButtonEventArgs e) { if (e.ClickCount >= 2) { object selectedItem = SearchResultList.SelectedItem; ListBoxItem selectedListBoxItem = SearchResultList.ItemContainerGenerator.ContainerFromItem(selectedItem) as ListBoxItem; SearchEntry entry = selectedListBoxItem.Content as SearchEntry; TileCanvas.Children.Remove(selectBorder); SelectTile(entry.Name); BitmapImage source = selectableTiles[index].Image.Source as BitmapImage; TileHover.Content = entry.Name; FirstSelected = true; LabelImg.Source = source; SearchResultList.Visibility = Visibility.Hidden; } }