private void ribbon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { for (int i = 0; i < stackPanelRibbons.Children.Count; i++) { for (int j = 0; j < ((StackPanel)stackPanelRibbons.Children[i]).Children.Count; j++) { ((StackPanel)((StackPanel)stackPanelRibbons.Children[i]).Children[j]).Background = new SolidColorBrush(Color.FromRgb(244, 244, 245)); } } ((StackPanel)sender).Background = new SolidColorBrush(Color.FromRgb(60, 120, 170)); RibbonData ribbon = PokemonDatabase.GetRibbonFromID(((StackPanel)sender).Tag as string); textBlockRibbonDescription.Text = ribbon.Name + " - " + ribbon.Description; }