<Window x:Class="HaCreator.GUI.InstanceEditor.LoadClassListSelector"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:local="clr-namespace:HaCreator.GUI.InstanceEditor"
        
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:charStructEnum="clr-namespace:MapleLib.WzLib.WzStructure.Data.CharacterStructure;assembly=MapleLib"
        xmlns:converter="clr-namespace:HaCreator.Converter"

        mc:Ignorable="d" Height="600" Width="321" Title="Select class categories:" 
        ResizeMode="NoResize">

    <Window.Resources>
        <!-- Data template for pet skill enum-->
        <ObjectDataProvider x:Key="CharacterJobTypeEnum" MethodName="GetValues"
                        ObjectType="{x:Type sys:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="charStructEnum:CharacterClassType"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        
        <!-- Converters -->
        <converter:CharacterJobTypeToCharacterJobStrConverter x:Key="characterJobTypeToCharacterJobStrConverter"/>
        <converter:EnumToIntValueConverter x:Key="enumToIntValueConverter"/>
    </Window.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="25"/>
            <RowDefinition Height="25"/>
        </Grid.RowDefinitions>

        <ListBox x:Name="comboBox_jobsCategoryList" 
                  ItemsSource="{Binding Source={StaticResource CharacterJobTypeEnum}}"  
                  SelectedValue="{Binding Jobs, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource characterJobTypeToCharacterJobStrConverter}}"
                  SelectedValuePath="."
                  Grid.Row="0"
                  >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="170"/>
                            <ColumnDefinition Width="25"/>
                        </Grid.ColumnDefinitions>

                        <StackPanel Orientation="Horizontal" Grid.Column="0">
                            <TextBlock Text="{Binding .}" />
                            <TextBlock Text="(" Margin="5,0,0,0"/>
                            <TextBlock Text="{Binding ., Converter={StaticResource enumToIntValueConverter}}" />
                            <TextBlock Text=")" Margin="0,0,0,0"/>
                        </StackPanel>

                        <CheckBox x:Name="checkbox_selectJobCategory"
                            Grid.Column="1" Content="X" FontSize="8" Width="15" Height="15" 
                                                        Margin="3,0,0,0"
                                  Checked="checkbox_selectJobCategory_CheckedUnchecked" Unchecked="checkbox_selectJobCategory_CheckedUnchecked"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <StackPanel Grid.Row="1" Orientation="Horizontal" 
                    VerticalAlignment="Center" HorizontalAlignment="Center">
            <TextBlock Text="Value: " Foreground="Gray" />
            <TextBlock x:Name="textblock_bitfield" Text="0" Margin="2,0,0,0" FontWeight="Bold"
                   Foreground="Gray" />
        </StackPanel>

        <Button x:Name="button_cfm" Content="Confirm"
                Grid.Row="2"
                Click="button_cfm_Click"
                />
    </Grid>
</Window>
