<UserControl x:Class="ComPDFKit.Controls.PDFControl.SetEncryptionControl"
             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:common="clr-namespace:ComPDFKit.Controls.Common" 
             mc:Ignorable="d"
             Height="362" Width="368">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/ComPDFKit.Controls;component/Asset/Styles/ComboBoxStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <common:SecurityResourceConverter x:Key="SecurityResourceConverter"/>
            <common:AndMultiBoolValueConverter x:Key="AndMultiValueConverter"></common:AndMultiBoolValueConverter>
            <common:ReverseBoolConverter x:Key="ReverseBoolConverter" />
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="12*"></RowDefinition>
            <RowDefinition Height="20*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        
        <Grid Background="White" Margin="20,0,0,0"  Panel.ZIndex="1" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top">
            <TextBlock Foreground="#001A4E" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Title_OpenPassword}" FontWeight="Bold" FontSize="16"></TextBlock>
        </Grid>
        <Border Margin="0,10,7,12" BorderBrush="#33000000" BorderThickness="1">
            <Grid Margin="8,0,20,15">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal">
                    <CheckBox IsChecked="{Binding IsUserPasswordEnabled, Mode=OneWayToSource}" x:Name="ChbUserPassword" Width="20" Height="20" Margin="0,5,0,0"></CheckBox>
                    <TextBlock Height="20" FontFamily="Microsoft YaHei" FontSize="14" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Chk_OpenPassword}"></TextBlock>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="20,0,0,-5">
                    <TextBlock Height="25" FontFamily="Microsoft YaHei" FontSize="14" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Password}"/>
                    <common:PasswordBoxControl Password="{Binding UserPassword, Mode=OneWayToSource}" IsEnabled="{Binding IsUserPasswordEnabled,Mode=OneWay}" Margin="10,0,0,0" Watermark="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Holder_EnterPassword}" Height="41" Width="210"></common:PasswordBoxControl>
                </StackPanel>
            </Grid>
        </Border>
        
        <Grid Grid.Row="1" Background="White" Margin="20,0,0,0"  Panel.ZIndex="1" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top">
            <TextBlock Foreground="#001A4E" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Title_OwnerPassword}" FontWeight="Bold" FontSize="16"></TextBlock>
        </Grid>
        <Border Grid.Row="1" Margin="0,10,7,5" BorderBrush="#33000000" BorderThickness="1">
            <Grid Margin="8,10,20,8">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal">
                    <CheckBox IsChecked="{Binding IsOwnerPasswordEnabled,Mode=OneWayToSource}" x:Name="ChbOwnerPassword" Width="20" Height="20" Margin="0,5,0,0"></CheckBox>
                    <TextBlock Height="20" FontFamily="Microsoft YaHei" FontSize="14" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Chk_OwnerPassword}"></TextBlock>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="20,0,0,0">
                    <TextBlock Height="25" FontFamily="Microsoft YaHei" FontSize="14" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_Password}"/>
                    <common:PasswordBoxControl Password="{Binding OwnerPassword, Mode=OneWayToSource}" IsEnabled="{Binding IsOwnerPasswordEnabled}" Margin="10,0,0,0" Watermark="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Holder_EnterPassword}" Height="41" Width="210"></common:PasswordBoxControl>
                </StackPanel>
                
                <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="20,0,0,0">
                    <CheckBox Width="20" Height="20" Margin="0,5,0,0"
                              IsChecked="{Binding IsAllowPrint,Converter={StaticResource ReverseBoolConverter} ,Mode=OneWayToSource}"
                              IsEnabled="{Binding IsOwnerPasswordEnabled}">
                    </CheckBox>
                    <TextBlock Height="20" FontFamily="Microsoft YaHei" FontSize="14" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Chk_NoPrint}"></TextBlock>
                </StackPanel>
                
                <StackPanel Grid.Row="3" Orientation="Horizontal" Margin="20,0,0,0">
                    <CheckBox Width="20" Height="20" Margin="0,5,0,0"
                              IsChecked="{Binding IsAllowCopy,Converter={StaticResource ReverseBoolConverter} ,Mode=OneWayToSource}"
                              IsEnabled="{Binding IsOwnerPasswordEnabled}">
                    </CheckBox>
                    <TextBlock Height="20" FontFamily="Microsoft YaHei" FontSize="14" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Chk_NoCopy}"></TextBlock>
                </StackPanel>
            </Grid>
        </Border>
        <DockPanel Grid.Row="2" Margin="10,0,10,10">
            <TextBlock HorizontalAlignment="Left" Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_EncryptionLevel}" FontFamily="Microsoft YaHei" FontSize="14" Margin="21,0,10,0" VerticalAlignment="Center"></TextBlock>
            <ComboBox HorizontalAlignment="Right" SelectedIndex="{Binding CryptographicLevel,Mode=OneWayToSource}" Style="{StaticResource ComboBoxStyle1}" FontFamily="Microsoft YaHei" FontSize="14" VerticalContentAlignment="Center" Width="150" Height="30" VerticalAlignment="Center">
                <ComboBoxItem IsSelected="True">128 - bit RC4</ComboBoxItem>
                <ComboBoxItem>128 - bit AES</ComboBoxItem>
                <ComboBoxItem>256 - bit AES</ComboBoxItem>
            </ComboBox>
        </DockPanel>
    </Grid>
</UserControl>
