<UserControl x:Class="GeekDesk.Control.UserControls.Config.ThemeControl"
             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:viewmodel="clr-namespace:GeekDesk.ViewModel"
             d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:hc="https://handyorg.github.io/handycontrol"
             xmlns:cvt="clr-namespace:GeekDesk.Converts" 
             mc:Ignorable="d" 
             Background="Transparent"
             d:DesignHeight="500" d:DesignWidth="450">


    <UserControl.Resources>
        <cvt:BGStyleConvert x:Key="BGStyleConvert"/>
        <cvt:StringAppendConvert x:Key="StringAppendConvert"/>
        <cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
    </UserControl.Resources>
    <Grid>
        <Grid Background="Transparent">
            <StackPanel Margin="20" >
                <hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
                    <TextBlock Text="背景风格" VerticalAlignment="Center"/>
                </hc:UniformSpacingPanel>
                <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
                    <RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" 
                         Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="图 片"
                         IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=1}"/>
                    <RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
                         Style="{StaticResource RadioButtonIcon}" Click="BGStyle_Changed" Content="纯 色" 
                         IsChecked="{Binding BGStyle, Mode=TwoWay, Converter={StaticResource BGStyleConvert}, ConverterParameter=2}"/>
                </hc:UniformSpacingPanel>

                <UniformGrid x:Name="ImgBGConf">
                    <hc:TransitioningContentControl TransitionMode="Fade" 
                                                    Height="130">
                        <StackPanel>
                            <hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
                                <TextBlock Text="图片背景" VerticalAlignment="Center"/>
                            </hc:UniformSpacingPanel>
                            <hc:UniformSpacingPanel Spacing="10" Margin="20,15,0,0" Grid.ColumnSpan="4">
                                <TextBlock Text="图片路径:" VerticalAlignment="Center" Margin="0,5,0,0"/>
                                <TextBlock Text="{Binding BacImgName}" Width="200" 
                                           Margin="0,5,0,0"
                                           VerticalAlignment="Center"
                                           hc:Poptip.HitMode="None" 
                                           hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
                                           hc:Poptip.Content="{Binding BacImgName}" 
                                           hc:Poptip.Placement="TopLeft"
                                           />
                                <Button Content="修改" Click="BGButton_Click"/>
                                <Button Content="默认" Click="DefaultButton_Click"/>
                            </hc:UniformSpacingPanel>

                            <hc:UniformSpacingPanel Spacing="10" Margin="20,10,0,0"  Grid.ColumnSpan="4">
                                <CheckBox x:Name="IconIsAdmin" Content="毛玻璃效果" Click="BGStyle_Changed" IsChecked="{Binding BlurEffect}">
                                    <CheckBox.Background>
                                        <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                            <GradientStop Color="#FF9EA3A6"/>
                                        </LinearGradientBrush>
                                    </CheckBox.Background>
                                </CheckBox>
                            </hc:UniformSpacingPanel>
                        </StackPanel>
                    </hc:TransitioningContentControl>

                </UniformGrid>

                <UniformGrid x:Name="GradientBGConf">
                    <hc:TransitioningContentControl TransitionMode="Fade" 
                                                    Height="130">
                        <StackPanel>
                            <hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
                                <TextBlock Text="纯色背景" VerticalAlignment="Center"/>
                            </hc:UniformSpacingPanel>
                            <hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
                                <TextBlock Text="色彩1:" VerticalAlignment="Center" Margin="0,5,0,0"/>
                                <TextBlock Text="{Binding GradientBGParam.Color1, NotifyOnTargetUpdated=True}"
                                           TargetUpdated="Color_TargetUpdated"
                                           Width="65" 
                                           Margin="0,5,0,0"
                                           VerticalAlignment="Center"
                                           />
                                <Button Content="设置" Tag="Color1" Click="ColorButton_Click"/>
                            </hc:UniformSpacingPanel>
                            <hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
                                <TextBlock Text="色彩2:" VerticalAlignment="Center" Margin="0,5,0,0"/>
                                <TextBlock Text="{Binding GradientBGParam.Color2, NotifyOnTargetUpdated=True}" 
                                           TargetUpdated="Color_TargetUpdated"
                                           Width="65" 
                                           Margin="0,5,0,0"
                                           VerticalAlignment="Center"
                                           />
                                <Button Content="设置" Tag="Color2" Click="ColorButton_Click"/>
                            </hc:UniformSpacingPanel>

                            <Button Content="系统预设"
                                    Margin="0,5,0,0"
                                    hc:Poptip.HitMode="None" 
                                    hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
                                    hc:Poptip.Content="{Binding GradientBGParam.Name, Converter={StaticResource StringAppendConvert}, ConverterParameter=当前设置: \{\}}" 
                                    hc:Poptip.Placement="Top"
                                    Click="SysBG_Click"
                                    />
                        </StackPanel>
                    </hc:TransitioningContentControl>
                </UniformGrid>


                <hc:Divider LineStrokeDashArray="3,3" Margin="0,0,0,0" Height="20" LineStroke="Black" Grid.ColumnSpan="1"/>
                
                <hc:UniformSpacingPanel Spacing="10" Margin="5,-10,0,0" Grid.ColumnSpan="4">
                    <CheckBox  Content="置于顶层" IsChecked="{Binding AlwaysTopmost}">
                        <CheckBox.Background>
                            <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                <GradientStop Color="#FF9EA3A6"/>
                            </LinearGradientBrush>
                        </CheckBox.Background>
                    </CheckBox>
                </hc:UniformSpacingPanel>

                <hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
                    <CheckBox  Content="主窗口动画" IsChecked="{Binding AppAnimation}" Click="Animation_Checked">
                        <CheckBox.Background>
                            <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                <GradientStop Color="#FF9EA3A6"/>
                            </LinearGradientBrush>
                        </CheckBox.Background>
                    </CheckBox>
                </hc:UniformSpacingPanel>
                <hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
                    <CheckBox  Content="列表展开动画" IsChecked="{Binding ItemSpradeAnimation}">
                        <CheckBox.Background>
                            <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                <GradientStop Color="#FF9EA3A6"/>
                            </LinearGradientBrush>
                        </CheckBox.Background>
                    </CheckBox>
                </hc:UniformSpacingPanel>
                <hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0"  Grid.ColumnSpan="4">
                    <CheckBox x:Name="BarIcon" Content="显示托盘图标" IsChecked="{Binding ShowBarIcon}">
                        <CheckBox.Background>
                            <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                <GradientStop Color="#FF9EA3A6"/>
                            </LinearGradientBrush>
                        </CheckBox.Background>
                    </CheckBox>
                </hc:UniformSpacingPanel>

                <hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0"  Grid.ColumnSpan="4">
                    <CheckBox  Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}">
                        <CheckBox.Background>
                            <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                <GradientStop Color="#FF9EA3A6"/>
                            </LinearGradientBrush>
                        </CheckBox.Background>
                    </CheckBox>
                </hc:UniformSpacingPanel>


                <StackPanel Margin="0,15,0,0">
                    <hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
                        <TextBlock Text="卡片不透明度" VerticalAlignment="Center"/>
                    </hc:UniformSpacingPanel>
                    <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
                        <hc:PreviewSlider Value="{Binding CardOpacity}"
                                  Maximum="100"
                                  Width="350"
                                  >
                            <hc:PreviewSlider.PreviewContent>
                                <Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
                            </hc:PreviewSlider.PreviewContent>
                        </hc:PreviewSlider>
                    </hc:UniformSpacingPanel>

                   

                    <hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
                        <TextBlock Text="背景不透明度" VerticalAlignment="Center"/>
                    </hc:UniformSpacingPanel>
                    <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
                        <hc:PreviewSlider Value="{Binding BgOpacity}"
                                          ValueChanged="BGOpacity_ValueChanged"
                                          Maximum="100"
                                          Width="350"
                                          > 
                            <hc:PreviewSlider.PreviewContent>
                                <Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
                            </hc:PreviewSlider.PreviewContent>
                        </hc:PreviewSlider>
                    </hc:UniformSpacingPanel>


                    <!--<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
                        <TextBlock Text="主面板不透明度" VerticalAlignment="Center"/>
                    </hc:UniformSpacingPanel>
                    <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
                        <hc:PreviewSlider Value="{Binding PannelOpacity}"
                                  Minimum="50"
                                  Maximum="100"
                                  Width="350"
                                  >
                            <hc:PreviewSlider.PreviewContent>
                                <Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
                            </hc:PreviewSlider.PreviewContent>
                        </hc:PreviewSlider>
                    </hc:UniformSpacingPanel>-->

                    <hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
                        <TextBlock Text="主面板圆角大小" VerticalAlignment="Center"/>
                    </hc:UniformSpacingPanel>
                    <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
                        <hc:PreviewSlider Value="{Binding PannelCornerRadius}"
                                  Maximum="25"
                                  Width="350"
                                  >
                            <hc:PreviewSlider.PreviewContent>
                                <Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
                            </hc:PreviewSlider.PreviewContent>
                        </hc:PreviewSlider>
                    </hc:UniformSpacingPanel>
                    <hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
                        <TextBlock Text="图标大小" VerticalAlignment="Center"/>
                    </hc:UniformSpacingPanel>
                    <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"
                                            Background="#00FFFFFF"
                                            PreviewMouseLeftButtonDown="PreviewSlider_MouseLeftButtonUp"
                                            >
                        <hc:PreviewSlider Value="{Binding ImageWidth, Mode=TwoWay}"
                                          Minimum="40"
                                          Maximum="60"
                                          Width="350"
                                          >
                            <hc:PreviewSlider.PreviewContent>
                                <Label Style="{StaticResource LabelPrimary}" Content="{Binding Path=(hc:PreviewSlider.PreviewPosition),RelativeSource={RelativeSource Self}}" ContentStringFormat="#0"/>
                            </hc:PreviewSlider.PreviewContent>
                        </hc:PreviewSlider>
                    </hc:UniformSpacingPanel>
                </StackPanel>
                <hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
                <hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
                    <TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
                    <TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
                    <Button Content="选择" Margin="0,-10,0,0" Tag="Text"  Click="ColorButton_Click"/>
                </hc:UniformSpacingPanel>
            </StackPanel>
        </Grid>

        <!--<StackPanel x:Name="ColorPanel" Panel.ZIndex="1" 
                    Visibility="Collapsed"
                    Height="500"
                    Width="450"
                    VerticalAlignment="Center">
            <StackPanel.Background>
                <SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
            </StackPanel.Background>-->

            <!--<hc:ColorPicker Name="MyColorPicker" 
                            Canceled="MyColorPicker_Canceled"
                            Confirmed="MyColorPicker_Confirmed"
                            SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>-->

        <!--</StackPanel>-->
    </Grid>

</UserControl>
