CPDFPageInsertUI.xaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <UserControl x:Class="ComPDFKit.Controls.PDFControlUI.CPDFPageInsertUI"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:ComPDFKit.Controls.PDFControlUI"
  7. xmlns:cpdfcommon="clr-namespace:ComPDFKit.Controls.Common"
  8. mc:Ignorable="d"
  9. d:DesignHeight="490" d:DesignWidth="432">
  10. <UserControl.Resources>
  11. <ResourceDictionary>
  12. <ResourceDictionary.MergedDictionaries>
  13. <ResourceDictionary Source="../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
  14. <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
  15. </ResourceDictionary.MergedDictionaries>
  16. <cpdfcommon:BoolToVisibleConverter x:Key="BoolToVisibleConverter"></cpdfcommon:BoolToVisibleConverter>
  17. <cpdfcommon:ReverseVisibilityConverter x:Key="ReverseVisibilityConverter"></cpdfcommon:ReverseVisibilityConverter>
  18. <cpdfcommon:DocEditorResourceConverter x:Key="DocEditorResourceConverter"></cpdfcommon:DocEditorResourceConverter>
  19. <cpdfcommon:OrMultiBoolValueConverter x:Key="AndMultiBoolValueConverter"></cpdfcommon:OrMultiBoolValueConverter>
  20. </ResourceDictionary>
  21. </UserControl.Resources>
  22. <Grid>
  23. <Grid.RowDefinitions>
  24. <RowDefinition Height="30"></RowDefinition>
  25. <RowDefinition></RowDefinition>
  26. <RowDefinition></RowDefinition>
  27. <RowDefinition Height="57"></RowDefinition>
  28. </Grid.RowDefinitions>
  29. <TextBlock FontSize="14" Margin="12,6" HorizontalAlignment="Left" VerticalAlignment="Top"
  30. Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Title_Insert}"></TextBlock>
  31. <Grid Grid.Row="1">
  32. <Border BorderBrush="#1A000000" BorderThickness="1" Width="382" Height="170">
  33. <Grid Margin="10">
  34. <Grid.RowDefinitions>
  35. <RowDefinition Height="70"></RowDefinition>
  36. <RowDefinition></RowDefinition>
  37. </Grid.RowDefinitions>
  38. <StackPanel Margin="0,5,0,0">
  39. <RadioButton GroupName="PageInsert" IsChecked="True" Name="BlankPagesCheckBox" Tag="BlankPages" Click="InsertTypeCheckBox_Click">
  40. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Option_Blank}"></TextBlock>
  41. </RadioButton>
  42. <RadioButton GroupName="PageInsert" Name="CustomBlankPagesCheckBox" Tag="CustomBlankPages" Margin="0,10,0,10" Click="InsertTypeCheckBox_Click">
  43. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Option_Custom}"></TextBlock>
  44. </RadioButton>
  45. <RadioButton GroupName="PageInsert" x:Name="OtherFileRadioButton" Tag="FromOtherPDF" Click="InsertTypeCheckBox_Click">
  46. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Option_From}"></TextBlock>
  47. </RadioButton>
  48. </StackPanel>
  49. <Grid Grid.Row="1" Grid.ColumnSpan="2">
  50. <StackPanel x:Name="OtherFilePanel" Orientation="Vertical" Visibility="{Binding IsChecked, ElementName=OtherFileRadioButton, Converter={StaticResource BoolToVisibleConverter}}">
  51. <StackPanel Orientation="Horizontal" Margin="0,6,0,0" IsEnabled="{Binding ElementName=OtherFileRadioButton, Path=IsChecked}">
  52. <Button x:Name="SelectFileButton" Width="75" Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Button_Select}" Click="SelectFileButton_Click"></Button>
  53. <TextBox x:Name="FilePathTextBox" Width="230" Height="28" Margin="8,0,0,0" IsReadOnly="True" VerticalContentAlignment="Center"/>
  54. </StackPanel>
  55. <StackPanel Orientation="Horizontal" Margin="0,6,0,0" IsEnabled="{Binding ElementName=OtherFileRadioButton, Path=IsChecked}">
  56. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Text_Range}" Width="83" VerticalAlignment="Center"></TextBlock>
  57. <cpdfcommon:WritableComboBoxControl x:Name="WritableComboBoxControl" Width="230" Margin="0,0,0,0" Loaded="WritableComboBoxControl_Loaded" Unloaded="WritableComboBoxControl_Unloaded"></cpdfcommon:WritableComboBoxControl>
  58. </StackPanel>
  59. </StackPanel>
  60. <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">
  61. <ComboBoxItem Content="A3"></ComboBoxItem>
  62. <ComboBoxItem Content="A4" IsSelected="True"></ComboBoxItem>
  63. <ComboBoxItem Content="A5"></ComboBoxItem>
  64. </ComboBox>
  65. <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>
  66. </Grid>
  67. </Grid>
  68. </Border>
  69. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Subtitle_Pages}" FontFamily="Microsoft YaHei" Margin="40,0,0,0" Background="White" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left" FontWeight="Bold"></TextBlock>
  70. </Grid>
  71. <Grid Grid.Row="2">
  72. <Border BorderBrush="#1A000000" BorderThickness="1" Width="382" Height="184">
  73. <Grid Margin="10,10,0,0">
  74. <Grid.RowDefinitions>
  75. <RowDefinition Height="40"></RowDefinition>
  76. <RowDefinition Height="40"></RowDefinition>
  77. <RowDefinition></RowDefinition>
  78. </Grid.RowDefinitions>
  79. <RadioButton GroupName="PageLocation" Name="HomePageRadioButton" Tag="HomePage" Margin="0,10,0,10" IsChecked="True" Click="PageInsertLocation_Click">
  80. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Option_First}"></TextBlock>
  81. </RadioButton>
  82. <RadioButton GroupName="PageLocation" Name="GastricPageRadioButton" Tag="GastricPage" Grid.Row="1" Margin="0,10,0,10" Click="PageInsertLocation_Click">
  83. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Option_Last}"></TextBlock>
  84. </RadioButton>
  85. <StackPanel Grid.Row="2" Margin="0,8,0,10">
  86. <StackPanel Orientation="Horizontal">
  87. <RadioButton GroupName="PageLocation" Name="CustomPageRadioButton" Tag="CustomPage" VerticalAlignment="Center" Click="PageInsertLocation_Click">
  88. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Option_Page}"/>
  89. </RadioButton>
  90. <cpdfcommon:NumericUpDownControl x:Name="PageTextBox" Maximum="{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}"/>
  91. <TextBlock Text="/" VerticalAlignment="Center" Margin="8,0,0,0" ></TextBlock>
  92. <TextBlock x:Name="MaxPageTextBox" Text="10000" VerticalAlignment="Center" ></TextBlock>
  93. </StackPanel>
  94. <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">
  95. <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Option_After }" IsSelected="True"></ComboBoxItem>
  96. <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Option_Before}"></ComboBoxItem>
  97. </ComboBox>
  98. </StackPanel>
  99. </Grid>
  100. </Border>
  101. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Subtitle_Pos}" FontFamily="Microsoft YaHei" Margin="40,-4,0,0" Background="White" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left" FontWeight="Bold"></TextBlock>
  102. </Grid>
  103. <StackPanel HorizontalAlignment="Right" Grid.Row="3" Orientation="Horizontal" Margin="0,0,25,0">
  104. <Button x:Name="CancelButton" Height="32" Width="112" Click="CancelButton_Click">
  105. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Button_Cancel}"></TextBlock>
  106. </Button>
  107. <Button x:Name="InsertButton" Height="32" Width="112" Margin="8,0,0,0" Click="InsertButton_Click">
  108. <Button.Content>
  109. <TextBlock Text="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Button_Insert}"></TextBlock>
  110. </Button.Content>
  111. <Button.IsEnabled>
  112. <MultiBinding Converter="{StaticResource AndMultiBoolValueConverter}">
  113. <Binding ElementName="HomePageRadioButton" Path="IsChecked"></Binding>
  114. <Binding ElementName="GastricPageRadioButton" Path="IsChecked"></Binding>
  115. <Binding ElementName="PageTextBox" Path="IsValueValid"></Binding>
  116. </MultiBinding>
  117. </Button.IsEnabled>
  118. </Button>
  119. </StackPanel>
  120. </Grid>
  121. </UserControl>