<Window x:Class="pkNX.WinForms.PokemonEditor"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:pkNX.WinForms"
        xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        xmlns:arceus="clr-namespace:pkNX.Structures.FlatBuffers.Arceus;assembly=pkNX.Structures.FlatBuffers.Arceus"
        mc:Ignorable="d"
        x:Name="PkmEditor"
        Background="{StaticResource Window.Background}"
        WindowStartupLocation="CenterScreen"
        Title="Pokémon Editor" Height="720" Width="720" MinHeight="720" MinWidth="720" Closing="Window_Closing" >
    <Window.Resources>
        <local:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" TrueValue="Collapsed" FalseValue="Visible" />
    </Window.Resources>

    <Grid>
        <!-- Layout -->
        <Grid.RowDefinitions>
            <!-- Details -->
            <RowDefinition Height="Auto"/>
            <!-- Split -->
            <RowDefinition Height="Auto"/>
            <!-- Tabs -->
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Details Section -->
        <Border Background="{StaticResource   DockWindow.Background}">
            <Grid Margin="3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <!-- Column 0 -->
                <Grid Margin="3">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <!-- Labels -->
                        <ColumnDefinition Width="*"/>
                        <!-- Textboxes -->
                        <ColumnDefinition Width="44"/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Column="0" Grid.Row="2" Content="Enabled:" HorizontalContentAlignment="Right"/>
                    <CheckBox Grid.Column="1" Grid.Row="2" x:Name="CHK_IsPresentInGame" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3" Checked="CHK_IsPresentInGame_Changed" Unchecked="CHK_IsPresentInGame_Changed"/>

                    <Label Grid.Column="0" Grid.Row="3" Content="In Area 1:" HorizontalContentAlignment="Right"/>
                    <CheckBox Grid.Column="1" Grid.Row="3" x:Name="CHK_InArea1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3"/>

                    <Label Grid.Column="0" Grid.Row="4" Content="In Area 2:" HorizontalContentAlignment="Right"/>
                    <CheckBox Grid.Column="1" Grid.Row="4" x:Name="CHK_InArea2" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3"/>

                    <Label Grid.Column="0" Grid.Row="5" Content="In Area 3:" HorizontalContentAlignment="Right"/>
                    <CheckBox Grid.Column="1" Grid.Row="5" x:Name="CHK_InArea3" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3"/>

                    <Label Grid.Column="0" Grid.Row="6" Content="In Area 4:" HorizontalContentAlignment="Right"/>
                    <CheckBox Grid.Column="1" Grid.Row="6" x:Name="CHK_InArea4" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3"/>

                    <Label Grid.Column="0" Grid.Row="7" Content="In Area 5:" HorizontalContentAlignment="Right"/>
                    <CheckBox Grid.Column="1" Grid.Row="7" x:Name="CHK_InArea5" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3"/>
                </Grid>

                <!-- Column 1 -->
                <Grid Grid.Column="2" Margin="3">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <!-- Labels -->
                        <ColumnDefinition Width="Auto"/>
                        <!-- Textboxes -->
                        <ColumnDefinition Width="44"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Label Grid.Column="0" Grid.Row="0" Content="Regional Dex:" HorizontalContentAlignment="Right"/>
                    <local:NumericTextBox MaxValue="9999" Grid.Column="1" Grid.Row="0" x:Name="TB_HisuianDex" Margin="3"/>

                    <Label Grid.Column="0" Grid.Row="1" Content="Base EXP:" HorizontalContentAlignment="Right"/>
                    <local:NumericTextBox Grid.Column="1" Grid.Row="1" x:Name="TB_BaseExp" Margin="3"/>

                    <Label Grid.Column="0" Grid.Row="2" Content="Catch Rate:" HorizontalContentAlignment="Right"/>
                    <local:NumericTextBox Grid.Column="1" Grid.Row="2" x:Name="TB_CatchRate" Margin="3"/>

                    <Label Grid.Column="0" Grid.Row="3" Content="Base Friendship:" HorizontalContentAlignment="Right"/>
                    <local:NumericTextBox Grid.Column="1" Grid.Row="3" x:Name="TB_Friendship" Margin="3"/>

                    <Label Grid.Column="0" Grid.Row="4" Content="Height:" HorizontalContentAlignment="Right"/>
                    <local:NumericTextBox NumberMode="Double" Grid.Column="1" Grid.Row="4" x:Name="TB_Height" Margin="3"/>
                    <Label Grid.Column="2" Grid.Row="4" Content="m"/>

                    <Label Grid.Column="0" Grid.Row="5" Content="Weight:" HorizontalContentAlignment="Right"/>
                    <local:NumericTextBox NumberMode="Double" Grid.Column="1" Grid.Row="5" x:Name="TB_Weight" Margin="3"/>
                    <Label Grid.Column="2" Grid.Row="5" Content="kg"/>
                </Grid>

                <!-- Column 2 -->
                <Grid Grid.Column="4" Margin="3">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <!-- Labels -->
                        <ColumnDefinition Width="Auto"/>
                        <!-- Textboxes -->
                        <ColumnDefinition Width="44"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Column="0" Grid.Row="1" Content="Color:" HorizontalContentAlignment="Right"/>
                    <ComboBox Grid.Column="1" Grid.Row="1" x:Name="CB_Color" Margin="3" Grid.ColumnSpan="2" ItemsSource="{Binding Source={x:Static local:UIStaticSources.PokeColors}}"/>

                    <Label Grid.Column="0" Grid.Row="2" Content="Typings:" HorizontalContentAlignment="Right"/>
                    <ComboBox Grid.Column="1" Grid.Row="2" x:Name="CB_Type1" Margin="3" Grid.ColumnSpan="2" ItemsSource="{Binding Source={x:Static local:UIStaticSources.TypesList}}"/>
                    <ComboBox Grid.Column="1" Grid.Row="3" x:Name="CB_Type2" Margin="3" Grid.ColumnSpan="2" ItemsSource="{Binding Source={x:Static local:UIStaticSources.TypesList}}"/>

                    <Label Grid.Column="0" Grid.Row="4" Content="Gender :" HorizontalContentAlignment="Right"/>
                    <local:NumericTextBox Grid.Column="1" Grid.Row="4" x:Name="TB_Gender" Margin="3" MaxValue="255" TextChanged="TB_Gender_TextChanged"/>
                    <Label Grid.Column="2" Grid.Row="4" x:Name="L_GenderDetails" Width="100" Content="♂88% / ♀11%"/>

                    <Label Grid.Column="0" Grid.Row="5" Content="EXP Group:" HorizontalContentAlignment="Right"/>
                    <ComboBox Grid.Column="1" Grid.Row="5" x:Name="CB_EXPGroup" Margin="3" Grid.ColumnSpan="2" ItemsSource="{Binding Source={x:Static local:UIStaticSources.EXPGroups}}"/>

                    <Label Grid.Column="0" Grid.Row="6" Content="Form Name:" HorizontalContentAlignment="Right" Visibility="Hidden"/>
                    <TextBox Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="6" x:Name="TB_FormName" Margin="3" IsReadOnly="True" Visibility="Hidden"/>
                </Grid>

                <!-- Status -->
                <Grid Grid.Column="6" Margin="3">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <ComboBox Grid.Row="0" MinWidth="108" Grid.Column="0" Margin="3"
                              SelectedIndex="{Binding SelectedSpecies, ElementName=PkmEditor}"
                              ItemsSource="{Binding Source={x:Static local:UIStaticSources.SpeciesList}}"/>
                    <TextBox Grid.Row="1" x:Name="TB_Classification" Margin="3" Height="22" IsReadOnly="True"/>

                    <!-- Sprite -->
                    <Border Width="132" Height="132" Grid.Row="2" Margin="3" BorderThickness="2" CornerRadius="1" Padding="0" Background="{StaticResource Window.Background}" HorizontalAlignment="Right">
                        <Border.BorderBrush>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                <GradientStop Color="{StaticResource DarkestColor}" Offset="0.0" />
                                <GradientStop Color="{StaticResource DarkestColor}" Offset="0.5" />
                                <GradientStop Color="{StaticResource SecondaryColor}" Offset="0.5001" />
                                <GradientStop Color="{StaticResource SecondaryColor}" Offset="1.0" />
                            </LinearGradientBrush>
                        </Border.BorderBrush>
                        <Grid>
                            <Image x:Name="IMG_MonSprite" Width="128" Height="128" d:Source="/icon.ico" Stretch="None"/>
                            <Rectangle Fill="#33FF0000" Visibility="{Binding IsChecked, ElementName=CHK_IsPresentInGame, Converter={StaticResource BoolToVisibilityConverter}}" />
                        </Grid>
                    </Border>

                    <!-- Navigation -->
                    <Grid Grid.Row="3" Margin="3" Width="132" Height="16" SnapsToDevicePixels="True" VerticalAlignment="Center" HorizontalAlignment="Center">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="26"/>
                            <ColumnDefinition Width="3"/>
                            <ColumnDefinition Width="26"/>
                            <ColumnDefinition MinWidth="6" Width="*"/>
                            <ColumnDefinition Width="26"/>
                            <ColumnDefinition Width="3"/>
                            <ColumnDefinition Width="26"/>
                        </Grid.ColumnDefinitions>

                        <Button Click="B_PreviousPokemon_Click" x:Name="B_PreviousPokemon" Padding="2.5">
                            <local:IconImage Icon="BackwardFast" IconFont="Solid" />
                        </Button>
                        <Button Grid.Column="2" Click="B_PreviousForm_Click" x:Name="B_PreviousForm" Padding="2.5">
                            <local:IconImage Icon="BackwardStep" IconFont="Solid" />
                        </Button>

                        <Button Grid.Column="4" Click="B_NextForm_Click" x:Name="B_NextForm" Padding="2.5">
                            <local:IconImage Icon="ForwardStep" IconFont="Solid" />
                        </Button>
                        <Button Grid.Column="6" Click="B_NextPokemon_Click" x:Name="B_NextPokemon" Padding="2.5">
                            <local:IconImage Icon="ForwardFast" IconFont="Solid" />
                        </Button>
                    </Grid>


                    <!-- Ids -->
                    <Grid Grid.Row="4">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="38"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="32"/>
                        </Grid.ColumnDefinitions>

                        <Label Grid.Column="0" Content="No." HorizontalContentAlignment="Right"/>
                        <local:NumericTextBox Grid.Column="1" Value="{Binding SelectedSpecies, ElementName=PkmEditor, Mode=TwoWay}" Margin="0,3,3,3" MaxValue="9999" x:Name="TB_Dex"/>

                        <Label Grid.Column="2" Content="Form:" HorizontalContentAlignment="Right"/>
                        <local:NumericTextBox Grid.Column="3" Margin="0,3,3,3"
                                              MaxValue="255"
                                              Value="{Binding SelectedForm, ElementName=PkmEditor}" />
                    </Grid>

                </Grid>
            </Grid>
        </Border>

        <Border Grid.Row="1" Height="1" Margin="0,0,0,12" Background="{StaticResource Separator.Background}"/>

        <!-- Tabs -->
        <TabControl x:Name="tabControl1" Grid.Row="2" Margin="3">
            <!-- Personal Tab -->
            <!-- TODO: The personal tab should contain data that is shared between games and the Details section at the top should contain all game specific data -->
            <TabItem Header="Personal" >
                <Grid Margin="3">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <Grid Margin="3">
                        <!-- Stats -->
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="38"/>
                                <ColumnDefinition Width="38"/>
                                <ColumnDefinition Width="38"/>
                                <ColumnDefinition Width="38"/>
                                <ColumnDefinition Width="38"/>
                                <ColumnDefinition Width="38"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="38"/>
                            </Grid.ColumnDefinitions>

                            <Label Grid.Column="0" Grid.Row="1" Content="Base Stats:" HorizontalContentAlignment="Right"/>
                            <Label Grid.Column="0" Grid.Row="2" Content="EV Yield:" HorizontalContentAlignment="Right"/>

                            <Label Grid.Column="1" Grid.Row="0" Content="HP:" HorizontalContentAlignment="Center" Padding="0"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="1" Grid.Row="1" x:Name="TB_BaseHP" Margin="3"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="1" Grid.Row="2" x:Name="TB_HPEVs" Margin="3"/>

                            <Label Grid.Column="2" Grid.Row="0" Content="Atk:" HorizontalContentAlignment="Center" Padding="0"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="2" Grid.Row="1" x:Name="TB_BaseATK" Margin="3"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="2" Grid.Row="2" x:Name="TB_ATKEVs" Margin="3"/>

                            <Label Grid.Column="3" Grid.Row="0" Content="Def:" HorizontalContentAlignment="Center" Padding="0"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="3" Grid.Row="1" x:Name="TB_BaseDEF" Margin="3"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="3" Grid.Row="2" x:Name="TB_DEFEVs" Margin="3"/>

                            <Label Grid.Column="4" Grid.Row="0" Content="SpA:" HorizontalContentAlignment="Center" Padding="0"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="4" Grid.Row="1" x:Name="TB_BaseSPA" Margin="3"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="4" Grid.Row="2" x:Name="TB_SPAEVs" Margin="3"/>

                            <Label Grid.Column="5" Grid.Row="0" Content="SpD:" HorizontalContentAlignment="Center" Padding="0"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="5" Grid.Row="1" x:Name="TB_BaseSPD" Margin="3"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="5" Grid.Row="2" x:Name="TB_SPDEVs" Margin="3"/>

                            <Label Grid.Column="6" Grid.Row="0" Content="Spe:" HorizontalContentAlignment="Center" Padding="0"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="6" Grid.Row="1" x:Name="TB_BaseSPE" Margin="3"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="6" Grid.Row="2" x:Name="TB_SPEEVs" Margin="3"/>

                            <Label Grid.Column="7" Grid.Row="1" Grid.RowSpan="2" Content="BST:" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            <local:NumericTextBox IsReadOnly="True" Grid.Column="8" Grid.Row="1" Grid.RowSpan="2" x:Name="TB_BST" Margin="3" VerticalAlignment="Center"/>
                        </Grid>
                    </Grid>

                    <!-- Personal Details -->
                    <Grid Grid.Row="1" Margin="3,3,3,12">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="5*"/>
                            <ColumnDefinition Width="38"/>
                            <ColumnDefinition Width="3*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="5*"/>
                            <ColumnDefinition Width="38"/>
                            <ColumnDefinition Width="3*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="5*"/>
                        </Grid.ColumnDefinitions>

                        <Label Grid.Column="0" Grid.Row="0" Content="Items:" HorizontalContentAlignment="Right"/>
                        <ComboBox Grid.Column="1" Grid.Row="0" x:Name="CB_HeldItem1" Margin="3" ItemsSource="{Binding Source={x:Static local:UIStaticSources.ItemsList}}" />
                        <ComboBox Grid.Column="1" Grid.Row="1" x:Name="CB_HeldItem2" Margin="3" ItemsSource="{Binding Source={x:Static local:UIStaticSources.ItemsList}}" />
                        <ComboBox Grid.Column="1" Grid.Row="2" x:Name="CB_HeldItem3" Margin="3" ItemsSource="{Binding Source={x:Static local:UIStaticSources.ItemsList}}" />
                        <Label Grid.Column="2" Grid.Row="0" Content="50%" HorizontalContentAlignment="Left"/>
                        <Label Grid.Column="2" Grid.Row="1" Content="5%"  HorizontalContentAlignment="Left"/>
                        <Label Grid.Column="2" Grid.Row="2" Content="1%"  HorizontalContentAlignment="Left"/>

                        <Label Grid.Column="4" Grid.Row="0" Content="Abilities:" HorizontalContentAlignment="Right"/>
                        <ComboBox Grid.Column="5" Grid.Row="0" x:Name="CB_Ability1" Margin="3" ItemsSource="{Binding Source={x:Static local:UIStaticSources.AbilitiesList}}" />
                        <ComboBox Grid.Column="5" Grid.Row="1" x:Name="CB_Ability2" Margin="3" ItemsSource="{Binding Source={x:Static local:UIStaticSources.AbilitiesList}}" />
                        <ComboBox Grid.Column="5" Grid.Row="2" x:Name="CB_Ability3" Margin="3" ItemsSource="{Binding Source={x:Static local:UIStaticSources.AbilitiesList}}" />
                        <Label Grid.Column="6" Grid.Row="0" Content="(1)" HorizontalContentAlignment="Left"/>
                        <Label Grid.Column="6" Grid.Row="1" Content="(2)" HorizontalContentAlignment="Left"/>
                        <Label Grid.Column="6" Grid.Row="2" Content="(H)" HorizontalContentAlignment="Left"/>

                        <Label Grid.Column="8" Grid.Row="0" Content="Egg Groups:" HorizontalContentAlignment="Right"/>
                        <ComboBox Grid.Column="9" Grid.Row="0" x:Name="CB_EggGroup1" Margin="3" ItemsSource="{Binding Source={x:Static local:UIStaticSources.EggGroups}}" />
                        <ComboBox Grid.Column="9" Grid.Row="1" x:Name="CB_EggGroup2" Margin="3" ItemsSource="{Binding Source={x:Static local:UIStaticSources.EggGroups}}" />
                        <Label Grid.Column="8" Grid.Row="2" Content="Hatched Species:" HorizontalContentAlignment="Right"/>
                        <ComboBox Grid.Column="9" Grid.Row="2" x:Name="CB_HatchSpecies" Margin="3" ItemsSource="{Binding Source={x:Static local:UIStaticSources.SpeciesList}}" />
                    </Grid>

                    <!-- Misc Details -->
                    <Grid Grid.Row="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <!-- Column 0 -->
                        <Grid Margin="3">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <!-- Labels -->
                                <ColumnDefinition Width="*"/>
                                <!-- Textboxes -->
                                <ColumnDefinition Width="38"/>
                            </Grid.ColumnDefinitions>

                            <Label Grid.Column="0" Grid.Row="0" Content="Local Form ID:" HorizontalContentAlignment="Right"/>
                            <local:NumericTextBox MaxValue="9999" Grid.Column="1" Grid.Row="0" x:Name="TB_LocalFormIndex" Margin="3"/>

                            <Label Grid.Column="0" Grid.Row="1" Content="Field_18:" HorizontalContentAlignment="Right"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="1" Grid.Row="1" x:Name="TB_Field_18" Margin="3"/>

                            <Label Grid.Column="0" Grid.Row="2" Content="Regional Form ID:" HorizontalContentAlignment="Right"/>
                            <local:NumericTextBox MaxValue="9999" Grid.Column="1" Grid.Row="2" x:Name="TB_RegionalFormIndex" Margin="3"/>

                            <Label Grid.Column="0" Grid.Row="3" Content="HatchCycles:" HorizontalContentAlignment="Right"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="1" Grid.Row="3" x:Name="TB_HatchCycles" Margin="3"/>

                            <Label Grid.Column="0" Grid.Row="4" Content="Form Count:" HorizontalContentAlignment="Right"/>
                            <local:NumericTextBox MaxValue="255" Grid.Column="1" Grid.Row="4" x:Name="TB_FormCount" Margin="3"/>

                            <Label Grid.Column="0" Grid.Row="5" Content="Is Regional Form:" HorizontalContentAlignment="Right"/>
                            <CheckBox Grid.Column="1" Grid.Row="5" x:Name="CHK_IsRegionalForm" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3"/>

                            <Label Grid.Column="0" Grid.Row="6" Content="Regional Variant:" HorizontalContentAlignment="Right"/>
                            <CheckBox Grid.Column="1" Grid.Row="6" x:Name="CHK_Variant" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="3"/>
                        </Grid>

                        <!-- Right Panel -->
                        <GroupBox Header="Misc Details" Grid.Column="1" Margin="3">

                            <!-- Misc fields -->
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Grid Margin="3">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <!-- Labels -->
                                        <ColumnDefinition Width="*"/>
                                        <!-- Textboxes -->
                                        <ColumnDefinition Width="38"/>
                                    </Grid.ColumnDefinitions>

                                    <Label Grid.Column="0" Grid.Row="0" Content="Species:" HorizontalContentAlignment="Right"/>
                                    <local:NumericTextBox MaxValue="255" Grid.Column="1" Grid.Row="0" x:Name="TB_MiscSpecies" Margin="3"/>

                                    <Label Grid.Column="0" Grid.Row="1" Content="Form:" HorizontalContentAlignment="Right"/>
                                    <local:NumericTextBox MaxValue="255" Grid.Column="1" Grid.Row="1" x:Name="TB_MiscForm" Margin="3"/>

                                    <Label Grid.Column="0" Grid.Row="2" Content="Scale:" HorizontalContentAlignment="Right"/>
                                    <local:NumericTextBox MaxValue="255" Grid.Column="1" Grid.Row="2" x:Name="TB_MiscScale" Margin="3"/>

                                    <Label Grid.Column="0" Grid.Row="3" Content="Alpha Scale:" HorizontalContentAlignment="Right"/>
                                    <local:NumericTextBox MaxValue="255" Grid.Column="1" Grid.Row="3" x:Name="TB_MiscAlphaScale" Margin="3"/>
                                </Grid>

                                <!-- Add winforms property grid -->
                                <WindowsFormsHost Grid.Column="1" Margin="3,0,0,0">
                                    <forms:PropertyGrid x:Name="PG_PokeMisc" SelectedObject="" HelpVisible="False" ToolbarVisible="False"/>
                                </WindowsFormsHost>
                            </Grid>

                        </GroupBox>

                    </Grid>
                </Grid>
            </TabItem>

            <!-- Pokedex Tab -->
            <TabItem Header="Pokedex">
                <Grid Margin="3">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <Grid>
                        <Label Content="Research Tasks:"/>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                            <Button Width="80" Margin="3" x:Name="B_AddTask" Content="Add Task" Click="B_AddTask_Click"/>
                            <Button Width="80" Margin="3" x:Name="B_CloneTask" Content="Clone Task" Click="B_CloneTask_Click"/>
                            <Button Width="80" Margin="3" x:Name="B_DeleteTask" Content="Delete Task" Click="B_DeleteTask_Click"/>
                        </StackPanel>
                    </Grid>

                    <DataGrid x:Name="DG_DexResearchTasks" Grid.Row="1"/>
                </Grid>
            </TabItem>

            <!-- Evolve Tab -->
            <TabItem Header="Evolutions">
                <Grid Margin="3">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <Grid>
                        <Label Content="Evolutions:"/>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                            <Button Width="80" Margin="3" x:Name="B_AddEvo" Content="Add Evo" Click="B_AddTask_Click"/>
                            <Button Width="80" Margin="3" x:Name="B_CloneEvo" Content="Clone Evo" Click="B_CloneTask_Click"/>
                            <Button Width="80" Margin="3" x:Name="B_DeleteEvo" Content="Delete Evo" Click="B_DeleteTask_Click"/>
                        </StackPanel>
                    </Grid>

                    <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <ItemsControl x:Name="IC_EvolutionsItems" Background="{StaticResource DockWindow.Background}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate DataType="{x:Type arceus:EvolutionEntry}">
                                    <local:EvolutionEntry Method="{Binding Method, Mode=TwoWay}"
                                                          Argument="{Binding Argument, Mode=TwoWay}"
                                                          Species="{Binding Species, Mode=TwoWay}"
                                                          Form="{Binding Form, Mode=TwoWay}"
                                                          Level="{Binding Level, Mode=TwoWay}"/>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>

                            <d:ItemsControl.ItemsSource>
                                <x:Array Type="arceus:EvolutionEntry">
                                    <arceus:EvolutionEntry Species="25" Form="0" Level="20" Method="4" Argument="0"/>
                                    <arceus:EvolutionEntry Species="26" Form="1" Level="30" Method="3" Argument="1"/>
                                    <arceus:EvolutionEntry Species="27" Form="2" Level="40" Method="4" Argument="2"/>
                                    <arceus:EvolutionEntry Species="28" Form="3" Level="50" Method="5" Argument="3"/>
                                    <arceus:EvolutionEntry Species="29" Form="4" Level="60" Method="6" Argument="4"/>
                                </x:Array>
                            </d:ItemsControl.ItemsSource>
                        </ItemsControl>
                    </ScrollViewer>
                </Grid>

            </TabItem>

            <!-- Learn Tab -->
            <TabItem Header="Learnset">
                <Grid Margin="3">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="2*"/>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="1*"/>
                    </Grid.ColumnDefinitions>

                    <!-- Level Up -->
                    <GroupBox Grid.Column="0" Header="Level Up Learnset:">
                        <DataGrid x:Name="DG_LevelUp" AutoGenerateColumns="False">
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="Level" MinWidth="32" Binding="{Binding Level}"/>
                                <DataGridTextColumn Header="Mastery Level" MinWidth="32" Binding="{Binding LevelMaster}"/>

                                <DataGridComboBoxColumn x:Name="dgvMove" Header="Move" ItemsSource="{Binding Source={x:Static local:UIStaticSources.MovesList}}">
                                    <DataGridComboBoxColumn.ElementStyle>
                                        <Style TargetType="ComboBox">
                                            <Setter Property="SelectedIndex" Value="{Binding Move,  UpdateSourceTrigger=PropertyChanged}" />
                                            <Setter Property="IsReadOnly" Value="True"/>
                                        </Style>
                                    </DataGridComboBoxColumn.ElementStyle>
                                    <DataGridComboBoxColumn.EditingElementStyle>
                                        <Style TargetType="ComboBox">
                                            <Setter Property="SelectedIndex" Value="{Binding Move, UpdateSourceTrigger=PropertyChanged}" />
                                        </Style>
                                    </DataGridComboBoxColumn.EditingElementStyle>
                                </DataGridComboBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </GroupBox>

                    <!-- TMS -->
                    <GroupBox Grid.Column="1" Header="TMs:">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <ListBox x:Name="CLB_TM" d:ItemsSource="{d:SampleData ItemCount=5}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <CheckBox Content="{Binding Name}" IsChecked="{Binding IsChecked}"/>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                            <Label Grid.Row="1" Content="TRs:" Padding="3,3,3,0"/>
                            <ListBox Grid.Row="2" x:Name="CLB_TR" d:ItemsSource="{d:SampleData ItemCount=5}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <CheckBox Content="{Binding Name}" IsChecked="{Binding IsChecked}"/>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Grid>
                    </GroupBox>

                    <!-- Tutors -->
                    <GroupBox Grid.Column="2" Header="Tutor Moves:">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="12"/>
                                <RowDefinition Height="2*"/>
                            </Grid.RowDefinitions>

                            <ListBox x:Name="CLB_TypeTutor" d:ItemsSource="{d:SampleData ItemCount=8}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <CheckBox Content="{Binding Name}" IsChecked="{Binding IsChecked}"/>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>

                            <ListBox Grid.Row="2" x:Name="CLB_SpecialTutor" d:ItemsSource="{d:SampleData ItemCount=5}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <CheckBox Content="{Binding Name}" IsChecked="{Binding IsChecked, Mode=TwoWay}"/>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Grid>
                    </GroupBox>

                </Grid>

            </TabItem>

            <!-- Enhancements Tab -->
            <TabItem Header="Enhancements" Visibility="Hidden">

                <TabControl>
                    <!-- Enhancement sections -->
                    <WrapPanel Grid.Row="0">
                        <Button Content="Randomize" Click="B_RandPersonal_Click"/>
                        <Button Content="Replace Trade" Click="B_TradeEvo_Click"/>
                        <Button Content="Random Every Level" Click="B_RandEvo_Click"/>
                    </WrapPanel>
                </TabControl>

            </TabItem>
        </TabControl>

        <!-- Menu -->
        <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="3,0,6,6">
            <Button Click="B_AufoFill_Click" Width="80" x:Name="B_AufoFill" Content="Auto Fill" />
            <Button Click="B_DumpTable_Click" Width="80" Margin="6,0,0,0" Content="Dump" x:Name="B_DumpTable"/>
        </StackPanel>
    </Grid>
</Window>
