<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageInsertDialog"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
             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:prism="http://prismlibrary.com/"             
             prism:ViewModelLocator.AutoWireViewModel="True"
             d:DesignHeight="441"
             d:DesignWidth="600"
             mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="48"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="64"></RowDefinition>
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Text="插入" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1,0,1" VerticalAlignment="Center" Height="329">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="3*"/>
                    <ColumnDefinition Width="4*"/>
                </Grid.ColumnDefinitions>
                <Grid Grid.Column="0">
                    <cus:PageTurningPreview x:Name="InsertPreview" Loaded="PageTurningPreview_Loaded"></cus:PageTurningPreview>
                </Grid>
                <Grid Grid.Column="1" Margin="7,27,13,40">
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0" Orientation="Vertical">
                        <TextBlock Text="插入文件"></TextBlock>
                        <StackPanel Orientation="Horizontal">
                            <TextBox Height="32" Width="198" Margin="0,0,4,0" VerticalContentAlignment="Center" Text="{Binding SelectFilePath}" Padding="16,0,6,0"></TextBox>
                            <Button Height="32" Width="56" Content="选择" Command="{Binding SelectFileCommand}"></Button>
                        </StackPanel>
                    </StackPanel>
                    <Grid Grid.Row="1"></Grid>
                    <StackPanel Grid.Row="1" Orientation="Vertical">
                        <TextBlock Text="插入位置" Height="22" Width="56" HorizontalAlignment="Left"></TextBlock>
                        <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
                            <RadioButton x:Name="FirstIsCheckRadioButton"  Margin="0,0,64,0" IsChecked="{Binding FirstIsCheck}" Command="{Binding FirstPageCommand}">
                                <TextBlock Text="第一页" Margin="12,0,0,0"></TextBlock>
                            </RadioButton>
                            <RadioButton x:Name="LastIsCheckRadioButton" IsChecked="{Binding LastIsCheck}" Command="{Binding LastPageCommand}">
                                <TextBlock Text="最后一页" Margin="12,0,0,0"></TextBlock>
                            </RadioButton>
                        </StackPanel>
                    </StackPanel>
                    <StackPanel Grid.Row="2" Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <RadioButton x:Name="CustomIsCheckRadioButton" VerticalAlignment="Center" IsChecked="{Binding CustomIsCheck}" Command="{Binding CustomPageCommand}"></RadioButton>
                            <TextBlock Text="页面" VerticalAlignment="Center"  Margin="12,0,0,0"></TextBlock>
                            <TextBox Name="PageInsertIndexTextBox" Height="32" Width="100" Text="{Binding PageInsertIndex}" InputMethod.IsInputMethodEnabled="False"  PreviewTextInput="CountTextBox_PreviewTextInput" IsEnabled="{Binding CustomIsEnabled}" TextChanged="PageInsertIndexTextBox_TextChanged"></TextBox>
                            <TextBlock Text="/" VerticalAlignment="Center"></TextBlock>
                            <TextBlock Name="PageCountText" Text="{Binding PageNumber}" VerticalAlignment="Center"></TextBlock>
                        </StackPanel>
                        <ComboBox Margin="28,7,13,0" SelectedIndex="{Binding PageLocation}">
                            <ComboBoxItem Content="之后"></ComboBoxItem>
                            <ComboBoxItem Content="之前"></ComboBoxItem>
                        </ComboBox>
                    </StackPanel>
                </Grid>
            </Grid>
        </Border>
        <Grid Grid.Row="2">
            <Button
                    Width="98"
                    Height="32"
                    Margin="16,0"
                    HorizontalAlignment="Right"
                    Command="{Binding CancelCommand}"
                    Content="取消" />
            <Button
                    Width="98"
                    Height="32"
                    Margin="124,0"
                    HorizontalAlignment="Right"
                    Command="{Binding InsertCommand}"
                    Content="插入" />
        </Grid>
    </Grid>
</UserControl>
