private UIElement CreateSpriteSelection(ushort dexID, FrontSpriteSelectionTypes type) { Grid grid = new Grid(); // Spinda has spot drawing code so we're not allowed to change him if (dexID != 327) { grid.PreviewMouseDown += OnSpriteSelectionClicked; grid.MouseEnter += OnSpriteSelectionEnter; grid.MouseLeave += OnSpriteSelectionLeave; if (PokeManager.Settings.FrontSpriteSelections[shinyMode ? 1 : 0, dexID - 1] == type) { grid.Background = spriteUnhighlightChecked; } else { grid.Background = spriteUnhighlight; } } else { grid.Background = spriteDisabled; } grid.Width = 64; grid.Height = 64; Image sprite = new Image(); sprite.Width = 64; sprite.Height = 64; sprite.IsHitTestVisible = false; if (type == FrontSpriteSelectionTypes.RSE) { if (shinyMode) { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).ShinyImage; } else { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).Image; } } else if (type == FrontSpriteSelectionTypes.FRLG) { if (shinyMode) { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).FRLGShinyImage; } else { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).FRLGImage; } } else { if (shinyMode) { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).CustomShinyImage; } else { sprite.Source = PokemonDatabase.GetPokemonImageTypes(dexID).CustomImage; } } grid.Children.Add(sprite); grid.Tag = new SpriteSelecionTag { DexID = dexID, Type = type }; return(grid); }