<Window x:Class="ComPDFKit.Controls.PDFControl.WatermarkDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ComPDFKit.Controls.PDFControl"
        xmlns:common="clr-namespace:ComPDFKit.Controls.Common"
        mc:Ignorable="d"
        Height="612" Width="900"
        Loaded="Window_Loaded" x:Name="watermarkDialog"
        ShowInTaskbar="False" 
        ResizeMode="NoResize">
    <Window.Resources>
        <ResourceDictionary>
            <common:SecurityResourceConverter x:Key="SecurityResourceConverter"/>
            <common:StringToVisibilityConverter x:Key="StringToVisibilityConverter"></common:StringToVisibilityConverter>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../Asset/Styles/RadioButtonStyle.xaml"></ResourceDictionary>
                <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
                <ResourceDictionary Source="../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid Margin="12">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"></ColumnDefinition>
            <ColumnDefinition/> 
        </Grid.ColumnDefinitions>
        <Grid  Width="248" Margin="0,0,0,56">
            <local:WatermarkPreviewControl  x:Name="PreviewControl"></local:WatermarkPreviewControl>
        </Grid>
        <Grid Grid.Column="1" Grid.ColumnSpan="2" Margin="0,0,0,56" Grid.RowSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <Grid Height="228">
                <Border BorderThickness="1" BorderBrush="#33000000" Margin="32,10,0,0" VerticalAlignment="Stretch" >
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                            <RowDefinition Height="auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid Margin="20,20,0,0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"></RowDefinition>
                                <RowDefinition Height="auto"></RowDefinition>
                                <RowDefinition Height="auto"></RowDefinition>
                                <RowDefinition Height="auto"></RowDefinition>
                            </Grid.RowDefinitions>
                            <RadioButton x:Name="TextRdo" IsChecked="True" GroupName="WatermarkType" Checked="TypeRdo_Checked">
                                <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Rdo_TextWatermark}"></TextBlock>
                            </RadioButton>
                            <TextBox Grid.Row="1" Height="28" Width="438" Text="{Binding WatermarkText, UpdateSourceTrigger=PropertyChanged}" Margin="32,6,0,0" HorizontalAlignment="Left" VerticalContentAlignment="Center" IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}"></TextBox>
                            <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="32,6,0,0" Height="30">
                                <ComboBox x:Name="FontFamilyCmb" Style="{StaticResource ComboBoxStyle1}" Width="242" Margin="0,0,20,0" SelectionChanged="FontFamilyCmb_SelectionChanged"  IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}">
                                </ComboBox>
                                <ComboBox x:Name="FontStyleCmb" Style="{StaticResource ComboBoxStyle1}" Width="90" Margin="0,0,20,0" SelectionChanged="FontStyleCmb_SelectionChanged" IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}"></ComboBox>
                                <ComboBox x:Name="FontSizeCmb" Style="{StaticResource ComboBoxStyle1}" Width="66" Margin="0,0,20,0" SelectionChanged="FontSizeCmb_SelectionChanged"  IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}">
                                    <ComboBoxItem Tag="24" >24</ComboBoxItem>
                                    <ComboBoxItem Tag="48" IsSelected="True">48</ComboBoxItem>
                                    <ComboBoxItem Tag="72" >72</ComboBoxItem>
                                    <ComboBoxItem Tag="96" >96</ComboBoxItem>
                                    <ComboBoxItem Tag="120" >120</ComboBoxItem>
                                    <ComboBoxItem Tag="144" >144</ComboBoxItem>
                                    <ComboBoxItem Tag="168" >168</ComboBoxItem>
                                    <ComboBoxItem Tag="192" >192</ComboBoxItem>
                                    <ComboBoxItem Tag="216" >216</ComboBoxItem>
                                    <ComboBoxItem Tag="240" >240</ComboBoxItem>
                                    <ComboBoxItem Tag="264" >264</ComboBoxItem>
                                    <ComboBoxItem Tag="288" >288</ComboBoxItem>
                                </ComboBox>

                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Grid.Row="3" Margin="32,0,0,0">
                                <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_FontColor}" VerticalAlignment="Center" Margin="0,0,8,0"></TextBlock>
                                <common:ColorPickerControl x:Name="ColorPickerControl" ColorChanged="ColorPickerControl_ColorChanged"  IsEnabled="{Binding Path=IsChecked, ElementName=TextRdo}"></common:ColorPickerControl>
                            </StackPanel>
                        </Grid>

                        <Grid  Margin="20,20,0,10" Grid.Row="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"></RowDefinition>
                                <RowDefinition Height="auto"></RowDefinition>
                            </Grid.RowDefinitions>
                            <RadioButton x:Name="ImageRdo" Grid.Row="0" GroupName="WatermarkType"  Checked="TypeRdo_Checked">
                                <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Rdo_ImageWatermark}"></TextBlock>
                            </RadioButton>
                            <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="32,6,0,0" Height="28">
                                <Button x:Name="ImagePathBtn" Style="{StaticResource ImagePathButtonStyle}" Width="296" Margin="0,0,20,0" Click="ImagePathBtn_Click"  IsEnabled="{Binding Path=IsChecked, ElementName=ImageRdo}">
                                    <Grid Margin="5,0,10,0">
                                        <TextBlock x:Name="PathTxt" Text="{Binding ImagePath}" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Microsoft YaHei"></TextBlock>
                                        <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Watermark}" VerticalAlignment="Center" HorizontalAlignment="Left" FontFamily="Microsoft YaHei" Visibility="{Binding ElementName=PathTxt, Path=Text, Converter={StaticResource StringToVisibilityConverter}}"></TextBlock>
                                        <Path VerticalAlignment="Center" HorizontalAlignment="Right" Data="M12.6172,14L15.8906,7.44531C15.9635,7.29948,16,7.14844,16,6.99219C16,6.85677,15.974,6.72917,15.9219,6.60938C15.8698,6.48958,15.7982,6.38411,15.707,6.29297C15.6159,6.20182,15.5091,6.13021,15.3867,6.07812C15.2643,6.02604,15.1354,6,15,6H13V4C13,3.85938,12.974,3.72917,12.9219,3.60938C12.8698,3.48958,12.7982,3.38411,12.707,3.29297C12.6159,3.20182,12.5104,3.13021,12.3906,3.07812C12.2708,3.02604,12.1406,3,12,3H6.25C6.08854,3,5.94661,2.97526,5.82422,2.92578C5.70182,2.8763,5.58724,2.8151,5.48047,2.74219C5.3737,2.66927,5.26823,2.58854,5.16406,2.5C5.0599,2.41146,4.94141,2.33073,4.80859,2.25781C4.67578,2.1849,4.52474,2.1237,4.35547,2.07422C4.1862,2.02474,3.98438,2,3.75,2H1C0.859375,2,0.729167,2.02604,0.609375,2.07812C0.489583,2.13021,0.384115,2.20182,0.292969,2.29297C0.201823,2.38411,0.130208,2.48958,0.078125,2.60938C0.0260417,2.72917,0,2.85938,0,3V14H12.6172ZM1,11.3828V3H3.75C3.91146,3,4.05339,3.02474,4.17578,3.07422C4.29818,3.1237,4.41276,3.1849,4.51953,3.25781C4.6263,3.33073,4.73177,3.41146,4.83594,3.5C4.9401,3.58854,5.05859,3.66927,5.19141,3.74219C5.32422,3.8151,5.47526,3.8763,5.64453,3.92578C5.8138,3.97526,6.01562,4,6.25,4H12V6H4.3125C4.11979,6,3.94401,6.04948,3.78516,6.14844C3.6263,6.2474,3.5026,6.38281,3.41406,6.55469L1,11.3828ZM1.3125,13H12L15,7H4.3125L1.3125,13Z" Fill="Black"/>
                                    </Grid>
                                </Button>
                                <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Watermark}" VerticalAlignment="Center" Margin="0,0,8,0"></TextBlock>
                                <common:NumericUpDownControl x:Name="ScaleNumericControl" Width="80" Text="{Binding ImageScale, Mode=TwoWay}" Maximum="500" Minimum="10" Unit="%"  IsEnabled="{Binding Path=IsChecked, ElementName=ImageRdo}"></common:NumericUpDownControl>
                            </StackPanel>
                        </Grid>
                    </Grid>
                </Border>
                <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Title_Watermark}" Margin="50,3,0,0" Background="#fff" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" FontWeight="DemiBold" FontFamily="Microsoft YaHei"></TextBlock>
            </Grid>
            <Grid Grid.Row="1" Margin="0,20,0,0">
                <Border BorderThickness="1" BorderBrush="#33000000" Margin="32,10,0,0" VerticalAlignment="Stretch" >
                    <Grid Margin="20">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition Width="242"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition Height="auto"></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock HorizontalAlignment="Right" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Rotation}"  VerticalAlignment="Center" Margin="0,0,8,0"></TextBlock>
                            <common:CPDFRotationControl Height="32" Width="186" Grid.Column="1" HorizontalAlignment="Left" RotationChanged="CPDFRotationControl_RotationChanged"></common:CPDFRotationControl>
                            <TextBlock HorizontalAlignment="Right" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Opacity}"  VerticalAlignment="Center" Margin="0,0,8,0" Grid.Row="1"></TextBlock>
                            <common:CPDFOpacityControl Height="32" Width="200" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="1" OpacityChanged="CPDFOpacityControl_OpacityChanged"></common:CPDFOpacityControl>
                            <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Layout}"  HorizontalAlignment="Right" Grid.Row="2"  Margin="0,8,8,0"></TextBlock>
                            <Grid Grid.Row="2" Grid.Column="1" Height="64">
                                <Grid.RowDefinitions>
                                    <RowDefinition></RowDefinition>
                                    <RowDefinition></RowDefinition>
                                </Grid.RowDefinitions>
                                <RadioButton x:Name="FrontRdo" IsChecked="True" Checked="LocationRdo_Checked">
                                    <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Rdo_Front}"></TextBlock>
                                </RadioButton>
                                <RadioButton x:Name="BehindRdo" Grid.Row="1"  Checked="LocationRdo_Checked">
                                    <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Rdo_Behind}"></TextBlock>
                                </RadioButton>
                            </Grid>
                            <TextBlock HorizontalAlignment="Right"  Grid.Row="3"  Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_PageRange}"  VerticalAlignment="Center"  Margin="0,0,8,0"></TextBlock>
                            <common:WritableComboBoxControl IsEnabled="{Binding CanChangeRange}" Height="32" Width="175"  Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left"></common:WritableComboBoxControl>
                        </Grid>
                        <Grid Grid.Column="1" Width="242">
                            <Grid.RowDefinitions>
                                <RowDefinition  Height="auto"></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <common:CPDFLocationControl x:Name="CPDFLocationControl" SelectedTagIndex="{Binding ElementName=watermarkDialog, Path=SelectedTag, Mode=TwoWay}" HorizOffsetChanged="CPDFLocationControl_HorizOffsetChanged" VertOffsetChanged="CPDFLocationControl_VertOffsetChanged" HorizontalAlignment="Left" Width="242"></common:CPDFLocationControl>
                            <common:CPDFTileControl x:Name="CPDFTileControl" Grid.Row="1" Height="72" VerticalAlignment="Bottom" HorizontalSpacingChanged="CPDFTileControl_HorizontalSpacingChanged" VerticalSpacingChanged="CPDFTileControl_VerticalSpacingChanged" FullScreenChanged="CPDFTileControl_FullScreenChanged"></common:CPDFTileControl>
                        </Grid>
                    </Grid>
                </Border>
                <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Title_WatermarkSettings}" Margin="50,3,0,0" Background="#fff" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center" FontWeight="DemiBold" FontFamily="Microsoft YaHei"></TextBlock>
            </Grid>
        </Grid>
        <Grid Grid.Row="1" Grid.ColumnSpan="3">
            <StackPanel Orientation="Horizontal" Margin="0,12,0,12" HorizontalAlignment="Right">
                <Button x:Name="ConfirmBtn" Height="32" Width="112" Margin="0,0,12,0" Click="ConfirmBtn_Click">
                    <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Button_OK}"></TextBlock>
                </Button>
                <Button x:Name="CancelBtn" Height="32" Width="112" Click="CancelBtn_Click">
                    <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Button_Cancel}"></TextBlock>
                </Button>
            </StackPanel>
        </Grid>
    </Grid>
</Window>
