<UserControl x:Class="_1RM.View.Settings.Theme.ThemeSettingView"
             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:_1RM.View.Settings.Theme"
             xmlns:colorPickerWpf="clr-namespace:ColorPickerWPF;assembly=Shawn.Utils.Wpf"
             xmlns:controls="clr-namespace:_1RM.Controls"
             mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance local:ThemeSettingViewModel}"
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <ScrollViewer>

        <StackPanel>

            <TextBlock Text="{DynamicResource Theme}" Style="{StaticResource BlockTitleColumn}" />

            <Grid Style="{StaticResource GridOneRow}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Column1"></ColumnDefinition>
                    <ColumnDefinition MinWidth="280" SharedSizeGroup="ThemeColumn2"></ColumnDefinition>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Column3"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <TextBlock Style="{StaticResource TextBlockTitleColumn}" Text="{DynamicResource Theme}"></TextBlock>

                <ComboBox Grid.Column="1"
                          ItemsSource="{Binding ThemeList}"
                          SelectedItem="{Binding ThemeName}">
                </ComboBox>

                <Button Grid.Column="2" HorizontalAlignment="Left" Margin="5 0 0 0" Style="{StaticResource ButtonPrimaryStyle}" Content="{DynamicResource Reset}" Command="{Binding CmdResetTheme}"></Button>
            </Grid>


            <TextBlock Text="{DynamicResource Custom}" Style="{StaticResource BlockTitleColumn}" />

            <Grid Width="450" HorizontalAlignment="Left">
                <Grid.RowDefinitions>
                    <RowDefinition Height="40"></RowDefinition>
                    <RowDefinition Height="40"></RowDefinition>
                    <RowDefinition Height="40"></RowDefinition>
                    <RowDefinition Height="40"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Column1"></ColumnDefinition>
                    <ColumnDefinition Width="50"></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.Resources>
                    <Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockBase}">
                        <Setter Property="TextAlignment" Value="Center"></Setter>
                        <Setter Property="VerticalAlignment" Value="Center"></Setter>
                        <Setter Property="HorizontalAlignment" Value="Left"></Setter>
                    </Style>
                    <Style TargetType="{x:Type colorPickerWpf:ColorPickRowPopup}">
                        <Setter Property="VerticalAlignment" Value="Center"></Setter>
                        <Setter Property="HorizontalAlignment" Value="Left"></Setter>
                        <Setter Property="HexVisible" Value="Collapsed"></Setter>
                    </Style>
                </Grid.Resources>

                <TextBlock Grid.Row="0" Grid.Column="2" Text="{DynamicResource Normal}"></TextBlock>
                <TextBlock Grid.Row="0" Grid.Column="3" Text="{DynamicResource Lighter}"></TextBlock>
                <TextBlock Grid.Row="0" Grid.Column="4" Text="{DynamicResource Darker}"></TextBlock>
                <TextBlock Grid.Row="0" Grid.Column="5" Text="{DynamicResource Font}"></TextBlock>

                <TextBlock Style="{StaticResource TextBlockTitleColumn}" Grid.Row="1" Grid.Column="0" Text="{DynamicResource Color1}"></TextBlock>
                <colorPickerWpf:ColorPickRowPopup Grid.Row="1" Grid.Column="2" HexColor="{Binding PrimaryMidColor}" />
                <colorPickerWpf:ColorPickRowPopup Grid.Row="1" Grid.Column="3" HexColor="{Binding PrimaryLightColor}" />
                <colorPickerWpf:ColorPickRowPopup Grid.Row="1" Grid.Column="4" HexColor="{Binding PrimaryDarkColor}" />
                <colorPickerWpf:ColorPickRowPopup Grid.Row="1" Grid.Column="5" HexColor="{Binding PrimaryTextColor}" />

                <TextBlock Style="{StaticResource TextBlockTitleColumn}" Grid.Row="2" Grid.Column="0" Text="{DynamicResource Color2}"></TextBlock>
                <colorPickerWpf:ColorPickRowPopup Grid.Row="2" Grid.Column="2" HexColor="{Binding AccentMidColor}" />
                <colorPickerWpf:ColorPickRowPopup Grid.Row="2" Grid.Column="3" HexColor="{Binding AccentLightColor}" />
                <colorPickerWpf:ColorPickRowPopup Grid.Row="2" Grid.Column="4" HexColor="{Binding AccentDarkColor}" />
                <colorPickerWpf:ColorPickRowPopup Grid.Row="2" Grid.Column="5" HexColor="{Binding AccentTextColor}" />

                <TextBlock Style="{StaticResource TextBlockTitleColumn}" Grid.Row="3" Grid.Column="0" Text="{DynamicResource Background}"></TextBlock>
                <colorPickerWpf:ColorPickRowPopup Grid.Row="3" Grid.Column="2" HexColor="{Binding BackgroundColor}" />
                <colorPickerWpf:ColorPickRowPopup Grid.Row="3" Grid.Column="5" HexColor="{Binding BackgroundTextColor}" />
            </Grid>



            <TextBlock Text="Font" Style="{StaticResource BlockTitleColumn}" />

            <Grid Style="{StaticResource GridOneRow}">
                <Grid.Resources>
                    <Style x:Key="YaHeiComboBoxItemStyle" TargetType="ComboBoxItem" BasedOn="{StaticResource ComboBoxItemAccentStyle}">
                        <Setter Property="FontFamily" Value="Microsoft YaHei"></Setter>
                    </Style>
                    <Style TargetType="ComboBox" BasedOn="{StaticResource ComboBoxAccentStyle}">
                        <Setter Property="FontFamily" Value="Microsoft YaHei"></Setter>
                        <Setter Property="ItemContainerStyle" Value="{StaticResource YaHeiComboBoxItemStyle}" />
                    </Style>
                </Grid.Resources>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Column1"></ColumnDefinition>
                    <ColumnDefinition MinWidth="280" MaxWidth="500" SharedSizeGroup="GeneralColumn2"></ColumnDefinition>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Column3"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Style="{StaticResource TextBlockTitleColumn}" Text="Font family" FontFamily="Microsoft YaHei"></TextBlock>

                <ComboBox Grid.Column="1" MinWidth="200" HorizontalAlignment="Left"
                          IsEditable="True" IsTextSearchEnabled="True"
                          FontFamily="Microsoft YaHei"
                          ItemsSource="{Binding FontFamilies}"
                          SelectedItem="{Binding FontFamily}"
                          >
                </ComboBox>
            </Grid>

            <Grid Style="{StaticResource GridOneRow}">
                <Grid.Resources>
                    <Style x:Key="YaHeiComboBoxItemStyle" TargetType="ComboBoxItem" BasedOn="{StaticResource ComboBoxItemAccentStyle}">
                        <Setter Property="FontFamily" Value="Microsoft YaHei"></Setter>
                    </Style>
                    <Style TargetType="ComboBox" BasedOn="{StaticResource ComboBoxAccentStyle}">
                        <Setter Property="FontFamily" Value="Microsoft YaHei"></Setter>
                        <Setter Property="ItemContainerStyle" Value="{StaticResource YaHeiComboBoxItemStyle}" />
                    </Style>
                </Grid.Resources>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Column1"></ColumnDefinition>
                    <ColumnDefinition MinWidth="280" MaxWidth="500" SharedSizeGroup="GeneralColumn2"></ColumnDefinition>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Column3"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Style="{StaticResource TextBlockTitleColumn}" Text="Font size" FontFamily="Microsoft YaHei"></TextBlock>

                <ComboBox Grid.Column="1" MinWidth="200" HorizontalAlignment="Left" 
                          IsEditable="False"
                          SelectedItem="{Binding FontSize}" 
                          ItemsSource="{Binding FontSizeOptions}"
                          DisplayMemberPath="Name"
                          FontFamily="Microsoft YaHei">
                </ComboBox>
            </Grid>
        </StackPanel>

        </ScrollViewer>
    </Grid>
</UserControl>
