<UserControl
    x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.SharpsAnnotProperty"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:CompositeControl="clr-namespace:PDF_Office.CustomControl.CompositeControl"
    xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
    xmlns:DashConvert="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel"
    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
    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.AnnotPanel"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:prism="http://prismlibrary.com/"
    d:DesignHeight="450"
    d:DesignWidth="800"
    prism:ViewModelLocator.AutoWireViewModel="True"
    mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../../Styles/SliderStyle.xaml" />
                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Convert:ColorToBrushConverter x:Key="ColorToBrushConvert" />
            <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert" />
            <DashConvert:DashStyleConverter x:Key="DashStyleConverter" />

            <Style x:Key="line1Style" TargetType="{x:Type Line}">
                <Setter Property="Visibility">
                    <Setter.Value>
                        <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
                            <Binding ElementName="SharpRectBtn" Path="IsChecked" />
                            <Binding ElementName="SharpCircleBtn" Path="IsChecked" />
                        </MultiBinding>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="line2Style" TargetType="{x:Type Line}">
                <Setter Property="Visibility">
                    <Setter.Value>
                        <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
                            <Binding ElementName="SharpCircleBtn" Path="IsChecked" />
                            <Binding ElementName="SharpArrowBtn" Path="IsChecked" />
                        </MultiBinding>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="line3Style" TargetType="{x:Type Line}">
                <Setter Property="Visibility">
                    <Setter.Value>
                        <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
                            <Binding ElementName="SharpArrowBtn" Path="IsChecked" />
                            <Binding ElementName="SharpLineBtn" Path="IsChecked" />
                        </MultiBinding>
                    </Setter.Value>
                </Setter>
            </Style>

        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Background="#F3F3F3">
        <StackPanel>
            <TextBlock
                Name="AnnotTypeTitle"
                Margin="10,8,0,0"
                HorizontalAlignment="Left"
                FontFamily="SegoeUI"
                FontSize="18"
                FontWeight="Bold"
                LineHeight="24"
                Text="{Binding AnnotTypeTitle}" />
            <Border
                Width="228"
                Height="100"
                Margin="0,8,0,0"
                Background="White"
                BorderBrush="#DDDDDD"
                BorderThickness="1"
                CornerRadius="2">
                <Grid>
                    <Path
                        Name="SharpPath"
                        Width="36"
                        Height="36"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Data="{Binding DataPath}"
                        Fill="{Binding FillColor}"
                        Opacity="{Binding FillOpacity}"
                        Stroke="{Binding SelectColor}"
                        StrokeDashArray="{Binding Dash, Converter={StaticResource DashStyleConverter}}"
                        StrokeStartLineCap="Flat"
                        StrokeThickness="{Binding LineWidth}">
                        <!--  ,Converter={StaticResource ColorToBrushConvert}  -->
                    </Path>
                </Grid>
            </Border>


            <Border
                Width="162"
                Height="32"
                Margin="0,12,0,0"
                BorderBrush="#FFE2E3E6"
                BorderThickness="1">
                <Grid Name="ToolGrid">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="40.5" />
                        <ColumnDefinition Width="40.5" />
                        <ColumnDefinition Width="40.5" />
                        <ColumnDefinition Width="40.5" />
                    </Grid.ColumnDefinitions>


                    <ToggleButton
                        Name="SharpRectBtn"
                        Width="40.5"
                        Background="Transparent"
                        BorderThickness="0"
                        Click="SharpsBtn_Click"
                        Command="{Binding SharpsTypeCommand}"
                        CommandParameter="{Binding ElementName=SharpRectBtn, Path=Tag}"
                        Tag="Rect">
                        <Rectangle
                            Width="16"
                            Height="16"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Stroke="#273C62" />
                    </ToggleButton>

                    <Line
                        Name="line1"
                        Grid.Column="1"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Stroke="#33000000"
                        StrokeThickness="1"
                        X1="0"
                        X2="0"
                        Y1="0"
                        Y2="16" />

                    <ToggleButton
                        Name="SharpCircleBtn"
                        Grid.Column="1"
                        Width="40.5"
                        Margin="0,0,0,0"
                        Background="Transparent"
                        BorderThickness="0"
                        Click="SharpsBtn_Click"
                        Command="{Binding SharpsTypeCommand}"
                        CommandParameter="{Binding ElementName=SharpCircleBtn, Path=Tag}"
                        Tag="Circle">
                        <Ellipse
                            Width="16"
                            Height="16"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Stroke="#273C62" />
                    </ToggleButton>


                    <Line
                        Name="line2"
                        Grid.Column="2"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Stroke="#33000000"
                        StrokeThickness="1"
                        Style="{StaticResource line2Style}"
                        X1="0"
                        X2="0"
                        Y1="0"
                        Y2="16" />
                    <ToggleButton
                        Name="SharpArrowBtn"
                        Grid.Column="2"
                        Width="40.5"
                        Background="Transparent"
                        BorderThickness="0"
                        Click="SharpsBtn_Click"
                        Command="{Binding SharpsTypeCommand}"
                        CommandParameter="{Binding ElementName=SharpArrowBtn, Path=Tag}"
                        Tag="Arrow">
                        <Path
                            Width="16"
                            Height="16"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Fill="#273C62">
                            <Path.Data>
                                M13.4,2.6 L13.4,8 L12.2,8 L12.1997359,4.648 L2.02426407,14.8242641 L1.17573593,13.9757359 L11.3517359,3.799 L8,3.8 L8,2.6 L13.4,2.6 Z
                            </Path.Data>
                        </Path>
                    </ToggleButton>

                    <Line
                        x:Name="line3"
                        Grid.Column="3"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Stroke="#33000000"
                        StrokeThickness="1"
                        Style="{StaticResource line3Style}"
                        X1="0"
                        X2="0"
                        Y1="0"
                        Y2="16" />
                    <ToggleButton
                        Name="SharpLineBtn"
                        Grid.Column="3"
                        Width="40.5"
                        Background="Transparent"
                        BorderThickness="0"
                        Click="SharpsBtn_Click"
                        Command="{Binding SharpsTypeCommand}"
                        CommandParameter="{Binding ElementName=SharpLineBtn, Path=Tag}"
                        Tag="Line">
                        <Polygon
                            Width="16"
                            Height="16"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Fill="#273C62">
                            <Polygon.Points>
                                13.1757359 1.97573593 14.0242641 2.82426407 2.82426407 14.0242641 1.97573593 13.1757359
                            </Polygon.Points>
                        </Polygon>
                    </ToggleButton>

                </Grid>
            </Border>


            <Grid x:Name="GridFill" Margin="0,18,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <CompositeControl:SlidContent x:Name="layerFill" HorizontalAlignment="Right" />
                <CompositeControl:ColorContent x:Name="cusFillColor" Grid.Row="1" />
            </Grid>

            <Grid Margin="0,18,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <CompositeControl:SlidContent x:Name="layerThick" HorizontalAlignment="Right" />
                <CompositeControl:ColorContent x:Name="cusColor" Grid.Row="1" />

            </Grid>



            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="auto" />
                </Grid.ColumnDefinitions>
                <Slider
                    Name="BorderSlider"
                    Margin="12,0,4,0"
                    VerticalAlignment="Center"
                    IsMoveToPointEnabled="True"
                    IsSelectionRangeEnabled="True"
                    IsSnapToTickEnabled="True"
                    Maximum="12"
                    Minimum="1"
                    Style="{StaticResource RoundThumbSlider}"
                    TickFrequency="1"
                    Value="{Binding LineWidth}">
                    <Slider.Resources>
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
                    </Slider.Resources>
                </Slider>

                <Border
                    Grid.Column="1"
                    Width="80"
                    Height="32"
                    Margin="0,0,12,0"
                    BorderBrush="#E2E3E6"
                    BorderThickness="0">
                    <Grid>
                        <ComboBox
                            Name="BorderDropBox"
                            Padding="10,10,0,0"
                            Background="Transparent"
                            BorderBrush="#FFE2E3E6"
                            BorderThickness="1">
                            <ComboBox.ItemContainerStyle>
                                <Style TargetType="{x:Type ComboBoxItem}">
                                    <Setter Property="Padding" Value="10,0,0,0" />
                                </Style>
                            </ComboBox.ItemContainerStyle>
                            <ComboBoxItem
                                Height="32"
                                VerticalContentAlignment="Center"
                                Content="1"
                                Template="{StaticResource comboxitem}" />
                            <ComboBoxItem
                                Height="32"
                                VerticalContentAlignment="Center"
                                Content="3"
                                Template="{StaticResource comboxitem}" />
                            <ComboBoxItem
                                Height="32"
                                VerticalContentAlignment="Center"
                                Content="6"
                                Template="{StaticResource comboxitem}" />
                            <ComboBoxItem
                                Height="32"
                                VerticalContentAlignment="Center"
                                Content="9"
                                Template="{StaticResource comboxitem}" />
                            <ComboBoxItem
                                Height="32"
                                VerticalContentAlignment="Center"
                                Content="12"
                                Template="{StaticResource comboxitem}" />
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="SelectionChanged">
                                    <i:InvokeCommandAction Command="{Binding ThicknessChangedCommand}" CommandParameter="{Binding ElementName=BorderDropBox, Path=SelectedItem}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </ComboBox>
                        <TextBox
                            Height="20"
                            Margin="10,0,35,0"
                            VerticalAlignment="Center"
                            Background="White"
                            BorderThickness="0"
                            FontFamily="Segoe UI"
                            FontSize="14"
                            IsReadOnly="True"
                            Text="{Binding ElementName=BorderSlider, Path=Value}"
                            TextAlignment="Left" />
                    </Grid>
                </Border>
            </Grid>


            <StackPanel
                x:Name="PnlLineStyle"
                Margin="0,20,0,0"
                Orientation="Horizontal">
                <cus:CustomIconToggleBtn
                    x:Name="BtnSolidLine"
                    Width="110"
                    Height="32"
                    Click="BtnLineStyle_Click"
                    Command="{Binding LineStyleCommand}"
                    CommandParameter="{Binding ElementName=BtnSolidLine, Path=Tag}"
                    Style="{StaticResource ToggleBtnViewModeStyle}"
                    Tag="Solid">
                    <Border
                        Width="108"
                        Height="30"
                        Padding="8,0,8,0"
                        BorderBrush="Black"
                        BorderThickness="1">
                        <Line
                            Stroke="Black"
                            StrokeThickness="2"
                            X1="10"
                            X2="260"
                            Y1="15"
                            Y2="15" />
                    </Border>
                </cus:CustomIconToggleBtn>
                <cus:CustomIconToggleBtn
                    x:Name="BtnDottedLine"
                    Width="110"
                    Height="32"
                    Click="BtnLineStyle_Click"
                    Command="{Binding LineStyleCommand}"
                    CommandParameter="{Binding ElementName=BtnDottedLine, Path=Tag}"
                    Style="{StaticResource ToggleBtnViewModeStyle}"
                    Tag="Dotted">
                    <Border
                        Width="108"
                        Height="30"
                        Padding="8,0,8,0"
                        BorderBrush="Black"
                        BorderThickness="1">
                        <Line
                            Stroke="Black"
                            StrokeDashArray="2"
                            StrokeThickness="2"
                            X1="10"
                            X2="260"
                            Y1="15"
                            Y2="15" />
                    </Border>
                </cus:CustomIconToggleBtn>
            </StackPanel>



        </StackPanel>
    </Grid>
</UserControl>
