<UserControl x:Class="Compdfkit_Tools.PDFControlUI.CPDFPageInsertUI"
             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="490" d:DesignWidth="432">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
            <cpdfcommon:BoolToVisibleConverter x:Key="BoolToVisibleConverter"></cpdfcommon:BoolToVisibleConverter>
            <cpdfcommon:ReverseVisibilityConverter x:Key="ReverseVisibilityConverter"></cpdfcommon:ReverseVisibilityConverter>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="57"></RowDefinition>
        </Grid.RowDefinitions>
        <TextBlock Text="Insert" FontSize="14" Margin="12,6" HorizontalAlignment="Left" VerticalAlignment="Top"></TextBlock>
        <Grid Grid.Row="1">
            <Border BorderBrush="#1A000000" BorderThickness="1" Width="382" Height="170">
                <Grid Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="70"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <StackPanel Margin="0,5,0,0">
                        <RadioButton GroupName="PageInsert" IsChecked="True" Name="BlankPagesCheckBox" Tag="BlankPages" Click="InsertTypeCheckBox_Click">
                            <TextBlock Text="Blank Page"></TextBlock>
                        </RadioButton>
                        <RadioButton GroupName="PageInsert" Name="CustomBlankPagesCheckBox" Tag="CustomBlankPages" Margin="0,10,0,10" Click="InsertTypeCheckBox_Click">
                            <TextBlock Text="Custom Blank Page"></TextBlock>
                        </RadioButton>
                        <RadioButton GroupName="PageInsert" x:Name="OtherFileRadioButton" Tag="FromOtherPDF" Click="InsertTypeCheckBox_Click">
                            <TextBlock Text="From other Files"></TextBlock>
                        </RadioButton>
                    </StackPanel>

                    <Grid Grid.Row="1" Grid.ColumnSpan="2">
                        <StackPanel x:Name="OtherFilePanel" Orientation="Vertical"  Visibility="{Binding IsChecked, ElementName=OtherFileRadioButton, Converter={StaticResource BoolToVisibleConverter}}">
                            <StackPanel Orientation="Horizontal" Margin="0,6,0,0" IsEnabled="{Binding ElementName=OtherFileRadioButton, Path=IsChecked}">
                                <Button x:Name="SelectFileButton" Width="70" Content="Select File" Click="SelectFileButton_Click"></Button>
                                <TextBox x:Name="FilePathTextBox" Width="230" Height="28" Margin="8,0,0,0" IsReadOnly="True" VerticalContentAlignment="Center"/>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Margin="0,6,0,0"  IsEnabled="{Binding ElementName=OtherFileRadioButton, Path=IsChecked}">
                                <TextBlock Text="Page Range" Width="80" VerticalAlignment="Center"></TextBlock>
                                <cpdfcommon:WritableComboBoxControl x:Name="WritableComboBoxControl" Width="230" Margin="0,0,0,0" Loaded="WritableComboBoxControl_Loaded" Unloaded="WritableComboBoxControl_Unloaded"></cpdfcommon:WritableComboBoxControl>
                            </StackPanel>
                        </StackPanel>
                        <ComboBox x:Name="PageSizeComboBox" Width="230" Height="28" Style="{StaticResource ComboBoxStyle1}" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="{Binding Visibility, ElementName=OtherFilePanel, Converter={StaticResource ReverseVisibilityConverter}}" IsEnabled="{Binding ElementName=CustomBlankPagesCheckBox, Path=IsChecked}" SelectionChanged="PageSizeComboBox_SelectionChanged"  VerticalContentAlignment="Center" Margin="19,5,0,0">
                            <ComboBoxItem Content="A3"></ComboBoxItem>
                            <ComboBoxItem Content="A4" IsSelected="True"></ComboBoxItem>
                            <ComboBoxItem Content="A5"></ComboBoxItem>
                        </ComboBox>
                        <Border Height="20" Visibility="{Binding ElementName=BlankPagesCheckBox, Path=IsChecked, Converter={StaticResource BoolToVisibleConverter}}" Width="100" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="24,9,0,0" Background="#EFEFEF"></Border>
                    </Grid>
                </Grid>
            </Border>
            <TextBlock Text="Page Insert" FontFamily="Segoe UI" Margin="40,0,0,0" Background="White" Width="70" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left" FontWeight="Bold"></TextBlock>
        </Grid>
        <Grid Grid.Row="2">
            <Border BorderBrush="#1A000000" BorderThickness="1" Width="382" Height="184">
                <Grid Margin="10,10,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"></RowDefinition>
                        <RowDefinition Height="40"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <RadioButton GroupName="PageLocation" Name="HomePageRadioButton" Tag="HomePage" Margin="0,10,0,10" IsChecked="True" Click="PageInsertLocation_Click">
                        <TextBlock Text="Home Page"></TextBlock>
                    </RadioButton>
                    <RadioButton GroupName="PageLocation" Name="GastricPageRadioButton" Tag="GastricPage" Grid.Row="1" Margin="0,10,0,10"  Click="PageInsertLocation_Click">
                        <TextBlock Text="Gastric Page"></TextBlock>
                    </RadioButton>
                    <StackPanel  Grid.Row="2" Margin="0,8,0,10">
                        <StackPanel Orientation="Horizontal">
                            <RadioButton GroupName="PageLocation" Name="CustomPageRadioButton" Tag="CustomPage" VerticalAlignment="Center" Click="PageInsertLocation_Click">
                                <TextBlock Text="Page"/>
                            </RadioButton>
                            <cpdfcommon:NumericUpDownControl x:Name="PageTextBox" Maxium="{Binding MaxIndex, Mode=OneWay}" Minimum="1" Text="{Binding CustomPageIndex, Mode=TwoWay}" Height="32" Width="175" Margin="12,0,0,0" IsEnabled="{Binding ElementName=CustomPageRadioButton, Path= IsChecked}"/>
                            <TextBlock Text="/"  VerticalAlignment="Center"  Margin="8,0,0,0" ></TextBlock>
                            <TextBlock x:Name="MaxPageTextBox" Text="10000"  VerticalAlignment="Center" ></TextBlock>
                        </StackPanel>
                        <ComboBox x:Name="PageLocationComboBox" Width="215" Height="32" HorizontalAlignment="Left" Margin="20,8,0,0"  Style="{StaticResource ComboBoxStyle1}" VerticalContentAlignment="Center" IsEnabled="{Binding ElementName=CustomPageRadioButton, Path= IsChecked}" SelectionChanged="PageLocationComboBox_SelectionChanged">
                            <ComboBoxItem Content="Back" IsSelected="True"></ComboBoxItem>
                            <ComboBoxItem Content="Font"></ComboBoxItem>
                        </ComboBox>
                    </StackPanel>
                </Grid>
            </Border>
            <TextBlock Text="Page Insert Location" FontFamily="Segoe UI" Margin="40,-4,0,0" Background="White" Width="120" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left" FontWeight="Bold"></TextBlock>
        </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="InsertButton" Height="32" Width="112"  Margin="8,0,0,0" Click="InsertButton_Click">
                <TextBlock Text="Insert"></TextBlock>
            </Button>
        </StackPanel>
    </Grid>
</UserControl>
