<UserControl
    x:Class="PDF_Office.Views.PropertyPanel.ViewModular.ThemesContent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ViewModular="clr-namespace:PDF_Office.ViewModels.PropertyPanel.ViewModular"
    xmlns:convert="clr-namespace:PDF_Office.DataConvert"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
    xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.ViewModular"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:prism="http://prismlibrary.com/"
    Name="ThemesContentName"
    d:DataContext="{d:DesignInstance Type=ViewModular:ThemesContentViewModel}"
    d:DesignHeight="248"
    d:DesignWidth="235"
    Loaded="UserControl_Loaded"
    mc:Ignorable="d">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/Styles/RadioButtonStyle.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Styles/ButtonStyle.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Styles/TextBoxStyle.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <convert:ObjectConvert x:Key="ObjectConvert" />
            <!--  虚线边框  -->
            <DrawingBrush
                x:Key="StaticborderBrush"
                TileMode="Tile"
                Viewport="0,0,8,8"
                ViewportUnits="Absolute">
                <DrawingBrush.Drawing>
                    <DrawingGroup>
                        <GeometryDrawing Brush="#FFA0A2AE">
                            <GeometryDrawing.Geometry>
                                <GeometryGroup>
                                    <RectangleGeometry Rect="0,0,50,50" />
                                    <RectangleGeometry Rect="50,50,50,50" />
                                </GeometryGroup>
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                    </DrawingGroup>
                </DrawingBrush.Drawing>
            </DrawingBrush>
            <DrawingBrush
                x:Key="OverborderBrush"
                TileMode="Tile"
                Viewport="0,0,8,8"
                ViewportUnits="Absolute">
                <DrawingBrush.Drawing>
                    <DrawingGroup>
                        <GeometryDrawing Brush="#477EDE">
                            <GeometryDrawing.Geometry>
                                <GeometryGroup>
                                    <RectangleGeometry Rect="0,0,50,50" />
                                    <RectangleGeometry Rect="50,50,50,50" />
                                </GeometryGroup>
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                    </DrawingGroup>
                </DrawingBrush.Drawing>
            </DrawingBrush>
            <ContextMenu x:Key="radioButtonRightMenu">
                <ContextMenu.ItemContainerStyle>
                    <Style TargetType="MenuItem">
                        <Setter Property="Padding" Value="-28,7,-80,7" />
                        <Setter Property="VerticalContentAlignment" Value="Center" />
                    </Style>
                </ContextMenu.ItemContainerStyle>
                <MenuItem Click="MenuItem_Click">
                    <MenuItem.Header>
                        <StackPanel Orientation="Horizontal">
                            <Path Data="M11,1 L11,3 L14,3 L14,4 L13,4 L13,15 L3,15 L3,4 L2,4 L2,3 L5,3 L5,1 L11,1 Z M12,4 L4,4 L4,14 L12,14 L12,4 Z M6,5 L6,13 L5,13 L5,5 L6,5 Z M8.5,5 L8.5,13 L7.5,13 L7.5,5 L8.5,5 Z M11,5 L11,13 L10,13 L10,5 L11,5 Z M10,2 L6,2 L6,3 L10,3 L10,2 Z" Fill="{StaticResource MenuIco.fill}" />
                            <TextBlock Margin="10,0,0,0" Text="删除" />
                        </StackPanel>
                    </MenuItem.Header>
                </MenuItem>
            </ContextMenu>
            <Style
                x:Key="CustomBtnStyle"
                BasedOn="{StaticResource TitleBarBtn}"
                TargetType="{x:Type Button}">
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="BorderBrush" Value="Transparent" />
                <Setter Property="Width" Value="auto" />
                <Setter Property="Height" Value="40" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Button}">
                            <Border
                                x:Name="border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{StaticResource StaticborderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                SnapsToDevicePixels="true">
                                <ContentPresenter
                                    x:Name="contentPresenter"
                                    Margin="{TemplateBinding Padding}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Focusable="False"
                                    RecognizesAccessKey="True"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter TargetName="border" Property="Background" Value="Transparent" />
                                    <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource OverborderBrush}" />
                                </Trigger>
                                <Trigger Property="IsPressed" Value="true">
                                    <Setter TargetName="border" Property="Background" Value="#C7D8F5" />
                                    <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource OverborderBrush}" />
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter TargetName="border" Property="Background" Value="Transparent" />
                                    <Setter TargetName="border" Property="BorderBrush" Value="#33000000" />
                                    <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="#FF999999" />
                                    <Setter TargetName="contentPresenter" Property="Opacity" Value="0.4" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>

    <WrapPanel Name="btnsPanel" Width="auto">
        <RadioButton
            Name="RBtnLight"
            Margin="4,0,4,0"
            Command="{Binding SetDrawModeCommand}"
            CommandParameter="{Binding ElementName=RBtnLight}"
            GroupName="DrawMode"
            IsChecked="{Binding LightDrawMode}"
            Style="{StaticResource PageViewRadioBtn}">
            <StackPanel Margin="0,0,3,0">
                <Border
                    Width="16"
                    Height="16"
                    Margin="0,0,0,8"
                    BorderBrush="#E2E3E6"
                    BorderThickness="1">
                    <Rectangle
                        Width="16"
                        Height="16"
                        Fill="White" />
                </Border>
                <TextBlock
                    x:Name="LightText"
                    Style="{StaticResource PagesView_txtContext}"
                    Text="Light" />
            </StackPanel>
        </RadioButton>
        <RadioButton
            Name="RBtnSepia"
            Margin="4,0,4,0"
            Command="{Binding SetDrawModeCommand}"
            CommandParameter="{Binding ElementName=RBtnSepia}"
            GroupName="DrawMode"
            IsChecked="{Binding SepiaDrawMode}"
            Style="{StaticResource PageViewRadioBtn}">
            <StackPanel Margin="0,0,3,0">
                <Border
                    Width="16"
                    Height="16"
                    Margin="0,0,0,8"
                    BorderBrush="#E2E3E6"
                    BorderThickness="1">
                    <Rectangle
                        Width="16"
                        Height="16"
                        Fill="#FFEFB2" />
                </Border>
                <TextBlock
                    x:Name="SepiaText"
                    Style="{StaticResource PagesView_txtContext}"
                    Text="Sepia" />
            </StackPanel>
        </RadioButton>
        <RadioButton
            Name="RBtnDark"
            Margin="4,0,4,0"
            Command="{Binding SetDrawModeCommand}"
            CommandParameter="{Binding ElementName=RBtnDark}"
            GroupName="DrawMode"
            IsChecked="{Binding DarkDrawMode}"
            Style="{StaticResource PageViewRadioBtn}">
            <StackPanel Margin="0,0,3,0">
                <Border
                    Width="16"
                    Height="16"
                    Margin="0,0,0,8"
                    BorderBrush="#E2E3E6"
                    BorderThickness="1">
                    <Rectangle
                        Width="16"
                        Height="16"
                        Fill="Black" />
                </Border>
                <TextBlock
                    x:Name="DarkText"
                    Style="{StaticResource PagesView_txtContext}"
                    Text="Dark" />
            </StackPanel>
        </RadioButton>

        <RadioButton
            Name="RBtnReseda"
            Margin="4,4,4,0"
            Command="{Binding SetDrawModeCommand}"
            CommandParameter="{Binding ElementName=RBtnReseda}"
            GroupName="DrawMode"
            IsChecked="{Binding ResedaDrawMode}"
            Style="{StaticResource PageViewRadioBtn}">
            <StackPanel Margin="0,0,3,0">
                <Border
                    Width="16"
                    Height="16"
                    Margin="0,0,0,8"
                    BorderBrush="#E2E3E6"
                    BorderThickness="1">
                    <Rectangle
                        Width="16"
                        Height="16"
                        Fill="#CBE9CE" />
                </Border>
                <TextBlock
                    x:Name="ResedaText"
                    Style="{StaticResource PagesView_txtContext}"
                    Text="Reseda" />
            </StackPanel>
        </RadioButton>
        <RadioButton
            Name="RBtnThemes1"
            Margin="4,4,4,0"
            GroupName="DrawMode"
            Command="{Binding SetDrawModeCommand}"
            CommandParameter="{Binding ElementName=RBtnThemes1}"
            ContextMenu="{StaticResource radioButtonRightMenu}"
            IsVisibleChanged="RBtnThemes1_IsVisibleChanged"
            Style="{StaticResource PageViewRadioBtn}"
            Visibility="Collapsed">
            <StackPanel Margin="0,0,3,0">
                <Border
                    Width="16"
                    Height="16"
                    Margin="0,0,0,8"
                    BorderBrush="#E2E3E6"
                    BorderThickness="1">
                    <Rectangle
                        Width="16"
                        Height="16"
                        Fill="#CBE9CE" />
                </Border>
                <TextBlock
                    x:Name="Theme1Text"
                    Style="{StaticResource PagesView_txtContext}"
                    Text="Theme1" />
            </StackPanel>
        </RadioButton>
        <RadioButton
            Name="RBtnThemes2"
            Margin="4,4,4,0"
            GroupName="DrawMode"
            Command="{Binding SetDrawModeCommand}"
            CommandParameter="{Binding ElementName=RBtnThemes2}"
            ContextMenu="{StaticResource radioButtonRightMenu}"
            IsVisibleChanged="RBtnThemes1_IsVisibleChanged"
            Style="{StaticResource PageViewRadioBtn}"
            Visibility="Collapsed">
            <StackPanel Margin="0,0,3,0">
                <Border
                    Width="16"
                    Height="16"
                    Margin="0,0,0,8"
                    BorderBrush="#E2E3E6"
                    BorderThickness="1">
                    <Rectangle
                        Width="16"
                        Height="16"
                        Fill="#CBE9CE" />
                </Border>
                <TextBlock
                    x:Name="Theme2Text"
                    Style="{StaticResource PagesView_txtContext}"
                    Text="Theme2" />
            </StackPanel>
        </RadioButton>
        <RadioButton
            Name="RBtnThemes3"
            Margin="4,4,4,0"
            GroupName="DrawMode"
            Command="{Binding SetDrawModeCommand}"
            CommandParameter="{Binding ElementName=RBtnThemes3}"
            ContextMenu="{StaticResource radioButtonRightMenu}"
            IsVisibleChanged="RBtnThemes1_IsVisibleChanged"
            Style="{StaticResource PageViewRadioBtn}"
            Visibility="Collapsed">
            <StackPanel Margin="0,0,3,0">
                <Border
                    Width="16"
                    Height="16"
                    Margin="0,0,0,8"
                    BorderBrush="#E2E3E6"
                    BorderThickness="1">
                    <Rectangle
                        Width="16"
                        Height="16"
                        Fill="#CBE9CE" />
                </Border>
                <TextBlock
                    x:Name="Theme3Text"
                    Style="{StaticResource PagesView_txtContext}"
                    Text="Theme3" />
            </StackPanel>
        </RadioButton>
        <RadioButton
            Name="RBtnThemes4"
            Margin="4,4,4,0"
            GroupName="DrawMode"
            Command="{Binding SetDrawModeCommand}"
            CommandParameter="{Binding ElementName=RBtnThemes4}"
            ContextMenu="{StaticResource radioButtonRightMenu}"
            IsVisibleChanged="RBtnThemes1_IsVisibleChanged"
            Style="{StaticResource PageViewRadioBtn}"
            Visibility="Collapsed">
            <StackPanel Margin="0,0,3,0">
                <Border
                    Width="16"
                    Height="16"
                    Margin="0,0,0,8"
                    BorderBrush="#E2E3E6"
                    BorderThickness="1">
                    <Rectangle
                        Width="16"
                        Height="16"
                        Fill="#CBE9CE" />
                </Border>
                <TextBlock
                    x:Name="Theme4Text"
                    Style="{StaticResource PagesView_txtContext}"
                    Text="Theme4" />
            </StackPanel>
        </RadioButton>
        <Border
            Width="72"
            Height="80"
            Margin="4,4,4,0">
            <Button
                Name="RBtnCustom"
                Width="60"
                Height="60"
                BorderThickness="1"
                Click="RBtnCustom_Click"
                Style="{DynamicResource CustomBtnStyle}">
                <StackPanel>
                    <Path
                        Margin="0,0,0,8"
                        HorizontalAlignment="Center"
                        Data="M8.5,2.5 L8.5,7.5 L13.5,7.5 L13.5,8.5 L8.5,8.5 L8.5,13.5 L7.5,13.5 L7.5,8.5 L2.5,8.5 L2.5,7.5 L7.5,7.5 L7.5,2.5 L8.5,2.5 Z"
                        Fill="{StaticResource MenuIco.fill}" />
                    <TextBlock
                        x:Name="CustomText"
                        Style="{StaticResource PagesView_txtContext}"
                        Text="Custom" />
                </StackPanel>
            </Button>
        </Border>
    </WrapPanel>

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <prism:InvokeCommandAction Command="{Binding LoadedCommand}" CommandParameter="{Binding ElementName=btnsPanel}" />
        </i:EventTrigger>
        <!--<i:EventTrigger EventName="MouseDown">
        <prism:InvokeCommandAction Command="{Binding MouseDownCommand}" CommandParameter="{Binding}" />
        </i:EventTrigger>-->
    </i:Interaction.Triggers>
</UserControl>