<UserControl x:Class="Compdfkit_Tools.PDFControlUI.CPDFPageExtractUI"
             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:local="clr-namespace:Compdfkit_Tools.PDFControlUI"
             xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
             mc:Ignorable="d" 
             d:DesignHeight="378" d:DesignWidth="432"
             Background="#FFF"
             BorderThickness="1">
    <UserControl.Resources>
        <ResourceDictionary>
            <cpdfcommon:ReverseBoolConverter x:Key="ReverseBoolConverter"></cpdfcommon:ReverseBoolConverter>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition Height="200"></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="57"></RowDefinition>
        </Grid.RowDefinitions>
        <TextBlock Text="Extract" FontSize="14" Margin="12,6" HorizontalAlignment="Left" VerticalAlignment="Top"></TextBlock>
        <Grid Grid.Row="1">
            <Border BorderBrush="#1A000000" BorderThickness="1" Width="382" Height="190" Margin="25,0,25,0">
                <StackPanel Orientation="Vertical" Margin="17">
                    <RadioButton Margin="0,20,0,0" x:Name="AllPagesRadioButton" GroupName="PageRange" IsChecked="True" Tag="AllPages" Click="PageRangeRadioButtonClick">
                        <TextBlock Text="All Pages"></TextBlock>
                    </RadioButton>
                    <RadioButton Margin="0,20,0,0"  x:Name="OddPagesRadioButton" GroupName="PageRange" Tag="OddPages" Click="PageRangeRadioButtonClick">
                        <TextBlock Text="Odd Pages Only"></TextBlock>
                    </RadioButton>
                    <RadioButton Margin="0,20,0,0"  x:Name="EvenPagesRadioButton" GroupName="PageRange" Tag="EvenPages" Click="PageRangeRadioButtonClick">
                        <TextBlock Text="Even Pages Only"></TextBlock>
                    </RadioButton>
                    <StackPanel Orientation="Horizontal" Margin="0,16,0,0">
                        <RadioButton x:Name="CustomPagesRadioButton" VerticalAlignment="Center" Tag="CustomPages" GroupName="PageRange"  Click="PageRangeRadioButtonClick">
                            <TextBlock Text="Custom Range"></TextBlock>
                        </RadioButton>
                        <TextBox x:Name="CustomPageRangeTextBox" Height="32" Width="135" Margin="12,0,0,0" IsEnabled="{Binding ElementName=CustomPagesRadioButton, Path=IsChecked}" TextChanged="TextBox_TextChanged" VerticalContentAlignment="Center"></TextBox>
                        <TextBlock Text="/"  VerticalAlignment="Center"  Margin="8,0,0,0"></TextBlock>
                        <TextBlock x:Name="MaxPageTextBlock" Text="10000" VerticalAlignment="Center"  Margin="8,0,0,0"></TextBlock>
                    </StackPanel>
                </StackPanel>
            </Border>
            <TextBlock Text="Page Range" FontFamily="Segoe UI" Margin="40,-1,0,0" Background="White" Width="70" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left" FontWeight="Bold"></TextBlock>
        </Grid>
        <Grid Grid.Row="2">
            <StackPanel Margin="42,10,0,0">
                <CheckBox Margin="0,10,0,0" Click="SeparateCheckBoxClick" >
                    <TextBlock Text="Each page in a separate file"></TextBlock>
                </CheckBox>
                <CheckBox x:Name="DeleteCheckBox" Margin="0,16,0,0" Click="DeleteCheckBoxClick" IsEnabled="{Binding ElementName=AllPagesRadioButton, Path=IsChecked, Converter={StaticResource ReverseBoolConverter}}">
                    <TextBlock Text="Delete pages after extraction"></TextBlock>
                </CheckBox>
            </StackPanel>
        </Grid>
        <StackPanel HorizontalAlignment="Right" Grid.Row="3" Orientation="Horizontal" Margin="0,0,25,0">
            <Button x:Name="CancelButton" Height="32" Width="112" Click="CancelButton_Click">
                <TextBlock Text="Cancel"></TextBlock>
            </Button>
            <Button x:Name="ExtractButton" Height="32" Width="112"  Margin="8,0,0,0" Click="ExtractButton_Click">
                <TextBlock Text="Extract"></TextBlock>
            </Button>
        </StackPanel>
    </Grid>
</UserControl>
