private void SearchAndShow() { clearPanel(); string PlayerClassFilter; string RarityFilter; string SearchFilter; string CardSetFilter; if (PlayerClass.Text == "All") { PlayerClassFilter = ""; } else { PlayerClassFilter = PlayerClass.Text; } if (Rarity.Text == "All") { RarityFilter = ""; } else { RarityFilter = Rarity.Text; } if (CardSet.Text == "All") { CardSetFilter = ""; } else { CardSetFilter = CardSet.Text; } foreach (card item in card.cardList.FindAll(c => c.PlayerClass.Contains(PlayerClassFilter) && c.Rarity.Contains(RarityFilter) && c.CardSet.Contains(CardSetFilter) && c.Name.ToLower().Contains(Search.Text.ToLower()) && int.Parse(c.Cost) >= int.Parse(ManaMin.Text) && int.Parse(c.Cost) <= int.Parse(ManaMax.Text) )) { BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(System.AppDomain.CurrentDomain.BaseDirectory + item.Img); bitmap.EndInit(); CardImage oneCard = new CardImage();// { Width = 307, Height = 465 }; oneCard.MouseLeftButtonDown += new MouseButtonEventHandler(oneCard_MouseLeftButtonDown); oneCard.MouseRightButtonDown += new MouseButtonEventHandler(oneCard_MouseRightButtonDown); oneCard.MouseEnter += new MouseEventHandler(oneCard_MouseEnter); oneCard.MouseLeave += new MouseEventHandler(oneCard_MouseLeave); oneCard.Tag = item; oneCard.image1.Source = bitmap; oneCard.label1.Content = getNumberOfCardInCollection(item.CardId).ToString(); stackPanel1.Children.Add(oneCard); } }