InsertDialog.xaml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <UserControl
  2. x:Class="PDF_Master.Views.Dialog.PageEditDialogs.InsertDialog"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:convert="clr-namespace:PDF_Master.DataConvert"
  6. xmlns:cus="clr-namespace:PDF_Master.CustomControl"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  9. xmlns:local="clr-namespace:PDF_Master.Views.Dialog.PageEditDialogs"
  10. xmlns:mainpage="clr-namespace:PDF_Master.Strings.MainPage"
  11. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  12. xmlns:model="clr-namespace:PDF_Master.Model.PageEdit"
  13. xmlns:pageeditdialogs="clr-namespace:PDF_Master.ViewModels.Dialog.PageEditDialogs"
  14. xmlns:prism="http://prismlibrary.com/"
  15. Width="530"
  16. Height="358"
  17. d:DataContext="{d:DesignInstance Type=pageeditdialogs:InsertDialogViewModel}"
  18. d:DesignHeight="358"
  19. d:DesignWidth="530"
  20. prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
  21. prism:ViewModelLocator.AutoWireViewModel="True"
  22. mc:Ignorable="d">
  23. <UserControl.Resources>
  24. <ResourceDictionary>
  25. <Style x:Key="TextBoxStyle" TargetType="TextBox">
  26. <Setter Property="Height" Value="32" />
  27. <Setter Property="FontSize" Value="14" />
  28. <Setter Property="Template">
  29. <Setter.Value>
  30. <ControlTemplate TargetType="TextBox">
  31. <Border
  32. x:Name="border"
  33. Background="{TemplateBinding Background}"
  34. BorderBrush="{TemplateBinding BorderBrush}"
  35. BorderThickness="{TemplateBinding BorderThickness}"
  36. CornerRadius="5"
  37. SnapsToDevicePixels="True">
  38. <!--<TextBox
  39. Name="markText"
  40. VerticalAlignment="Center"
  41. Background="Transparent"
  42. BorderBrush="Transparent"
  43. FontSize="12"
  44. Text="{TemplateBinding Text}"
  45. Visibility="Visible" />-->
  46. </Border>
  47. <ControlTemplate.Triggers>
  48. <Trigger Property="IsEnabled" Value="false">
  49. <Setter TargetName="border" Property="Opacity" Value="0.56" />
  50. <Setter TargetName="border" Property="Background" Value="{StaticResource color.field.bg.dis}" />
  51. </Trigger>
  52. <Trigger Property="IsMouseOver" Value="true">
  53. <Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
  54. </Trigger>
  55. <Trigger Property="IsKeyboardFocused" Value="true">
  56. <Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
  57. </Trigger>
  58. </ControlTemplate.Triggers>
  59. </ControlTemplate>
  60. </Setter.Value>
  61. </Setter>
  62. </Style>
  63. <convert:FileToImageSourceConvert x:Key="FileToImageSourceConvert" />
  64. <DataTemplate x:Key="CustomItem" DataType="{x:Type model:CustomPageItem}">
  65. <StackPanel HorizontalAlignment="Center">
  66. <Border
  67. Name="BdBorder"
  68. Width="104"
  69. Height="64"
  70. BorderBrush="#A0A2AE"
  71. BorderThickness="1"
  72. CornerRadius="6">
  73. <Border.Background>
  74. <ImageBrush ImageSource="{Binding FilePath, Converter={StaticResource FileToImageSourceConvert}}" />
  75. </Border.Background>
  76. </Border>
  77. <Label
  78. Name="LbPageNum"
  79. Width="auto"
  80. Margin="0,4,0,0"
  81. HorizontalAlignment="Center"
  82. Background="Transparent"
  83. Content="{Binding Name}"
  84. FontSize="12" />
  85. </StackPanel>
  86. <DataTemplate.Triggers>
  87. <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
  88. <Setter TargetName="BdBorder" Property="BorderBrush" Value="#118AFF" />
  89. <Setter TargetName="BdBorder" Property="CornerRadius" Value="4" />
  90. <Setter TargetName="LbPageNum" Property="Foreground" Value="#118AFF" />
  91. </DataTrigger>
  92. </DataTemplate.Triggers>
  93. </DataTemplate>
  94. </ResourceDictionary>
  95. </UserControl.Resources>
  96. <cus:DialogContent Header="{x:Static mainpage:MainPage.PageEdit_InsertaCustomPage}">
  97. <cus:DialogContent.Content>
  98. <Grid>
  99. <Grid.RowDefinitions>
  100. <!--<RowDefinition />-->
  101. <RowDefinition Height="auto" />
  102. <RowDefinition Height="auto" />
  103. </Grid.RowDefinitions>
  104. <!-- 20230704 如果设置为Hidden,可能会导致弹窗无法打开,报 图片被占用 -->
  105. <ListBox
  106. Padding="0,16,0,0"
  107. HorizontalAlignment="Center"
  108. BorderThickness="0"
  109. ItemTemplate="{StaticResource CustomItem}"
  110. ItemsSource="{Binding Pages}"
  111. SelectedIndex="{Binding ItemSelectedIndex, Mode=TwoWay}"
  112. Visibility="Collapsed">
  113. <ListBox.ItemContainerStyle>
  114. <Style TargetType="{x:Type ListBoxItem}">
  115. <Setter Property="Template" Value="{StaticResource ListBoxItemControlTemplate}" />
  116. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  117. </Style>
  118. </ListBox.ItemContainerStyle>
  119. <ListBox.ItemsPanel>
  120. <ItemsPanelTemplate>
  121. <WrapPanel />
  122. </ItemsPanelTemplate>
  123. </ListBox.ItemsPanel>
  124. </ListBox>
  125. <StackPanel Grid.Row="0" Margin="16,5,16,12">
  126. <TextBlock
  127. FontFamily="Segoe UI"
  128. FontSize="12"
  129. FontWeight="SemiBold"
  130. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  131. Text="{x:Static mainpage:MainPage.PageEdit_PageSize}" />
  132. <StackPanel
  133. Margin="0,10"
  134. VerticalAlignment="Bottom"
  135. Orientation="Horizontal">
  136. <RadioButton
  137. Height="32"
  138. VerticalContentAlignment="Center"
  139. Content="{x:Static mainpage:MainPage.PageEdit_CurrentPage}"
  140. FontFamily="Segoe UI"
  141. FontSize="14"
  142. GroupName="PageSize"
  143. IsChecked="{Binding IsCurrentSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  144. IsEnabled="{Binding IsCurrentIsEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  145. <Label
  146. Height="32"
  147. Margin="8,0"
  148. HorizontalAlignment="Center"
  149. VerticalContentAlignment="Center"
  150. Content="{Binding CurrentPageSize}"
  151. FontFamily="Segoe UI"
  152. FontSize="14" />
  153. </StackPanel>
  154. <StackPanel Margin="0,10" Orientation="Horizontal">
  155. <RadioButton
  156. Name="RbtnStandard"
  157. VerticalAlignment="Center"
  158. Content="{x:Static mainpage:MainPage.PageEdit_Standard}"
  159. FontFamily="Segoe UI"
  160. FontSize="14"
  161. GroupName="PageSize"
  162. IsChecked="{Binding IsStandSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  163. <ComboBox
  164. Width="228"
  165. Height="32"
  166. Margin="8,0"
  167. IsEnabled="{Binding ElementName=RbtnStandard, Path=IsChecked}"
  168. ItemsSource="{Binding PageSize}"
  169. SelectedIndex="{Binding PageSizeSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  170. </StackPanel>
  171. <StackPanel Margin="0,10" Orientation="Horizontal">
  172. <RadioButton
  173. Name="RbtnCustom"
  174. VerticalAlignment="Center"
  175. Content="{x:Static mainpage:MainPage.PageEdit_InsertaCustomPage}"
  176. FontFamily="Segoe UI"
  177. FontSize="14"
  178. GroupName="PageSize"
  179. IsChecked="{Binding IsCustomSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  180. <!--<TextBox
  181. Width="94"
  182. Height="32"
  183. Margin="8,0"
  184. VerticalContentAlignment="Center"
  185. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  186. Style="{StaticResource TextBoxStyle}"
  187. Text="{Binding CustomWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />-->
  188. <TextBox
  189. Width="94"
  190. Height="32"
  191. Margin="8,0"
  192. Padding="8,0"
  193. HorizontalContentAlignment="Left"
  194. VerticalContentAlignment="Center"
  195. Background="{StaticResource color.field.bg.def}"
  196. BorderBrush="{StaticResource color.field.border.norm}"
  197. InputMethod.IsInputMethodEnabled="False"
  198. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  199. Text="{Binding CustomWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
  200. <TextBox.Resources>
  201. <Style TargetType="{x:Type Border}">
  202. <Setter Property="CornerRadius" Value="4" />
  203. </Style>
  204. </TextBox.Resources>
  205. </TextBox>
  206. <TextBlock
  207. Margin="5,0"
  208. VerticalAlignment="Center"
  209. FontFamily="Segoe UI"
  210. FontSize="14"
  211. Text="X" />
  212. <!--<TextBox
  213. Width="80"
  214. Height="32"
  215. Margin="8,0"
  216. VerticalContentAlignment="Center"
  217. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  218. Text="{Binding CustomHeight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />-->
  219. <TextBox
  220. Width="94"
  221. Height="32"
  222. Margin="8,0"
  223. Padding="8,0"
  224. HorizontalContentAlignment="Left"
  225. VerticalContentAlignment="Center"
  226. Background="{StaticResource color.field.bg.def}"
  227. BorderBrush="{StaticResource color.field.border.norm}"
  228. InputMethod.IsInputMethodEnabled="False"
  229. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  230. Text="{Binding CustomHeight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
  231. <TextBox.Resources>
  232. <Style TargetType="{x:Type Border}">
  233. <Setter Property="CornerRadius" Value="4" />
  234. </Style>
  235. </TextBox.Resources>
  236. </TextBox>
  237. <ComboBox
  238. Width="94"
  239. Margin="8,0"
  240. VerticalContentAlignment="Center"
  241. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  242. ItemsSource="{Binding Units}"
  243. SelectedIndex="{Binding UnitsSelectedIndex}" />
  244. </StackPanel>
  245. </StackPanel>
  246. <StackPanel Grid.Row="1" Margin="16,0">
  247. <TextBlock
  248. FontFamily="Segoe UI"
  249. FontSize="12"
  250. FontWeight="SemiBold"
  251. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  252. Text="{x:Static mainpage:MainPage.Print_Orientation}" />
  253. <StackPanel Orientation="Horizontal">
  254. <RadioButton
  255. Width="105"
  256. Margin="0,12,0,16"
  257. VerticalContentAlignment="Center"
  258. Content="{x:Static mainpage:MainPage.PageEdit_VerticalPage}"
  259. FontFamily="Segoe UI"
  260. FontSize="14"
  261. GroupName="Direction"
  262. IsChecked="{Binding IsVerticalSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  263. Tag="Vertical" />
  264. <RadioButton
  265. Width="120"
  266. Margin="30,12,0,16"
  267. VerticalContentAlignment="Center"
  268. Content="{x:Static mainpage:MainPage.PageEdit_HorizontalPage}"
  269. FontFamily="Segoe UI"
  270. FontSize="14"
  271. GroupName="Direction"
  272. IsChecked="{Binding IsHorizontalSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  273. Tag="Horizontal" />
  274. </StackPanel>
  275. </StackPanel>
  276. </Grid>
  277. </cus:DialogContent.Content>
  278. <cus:DialogContent.BottmBar>
  279. <Grid>
  280. <Button
  281. Width="98"
  282. Height="32"
  283. Margin="16,0"
  284. HorizontalAlignment="Right"
  285. Command="{Binding CancelCommand}"
  286. Content="{x:Static mainpage:MainPage.PageEdit_Cancel}"
  287. Style="{StaticResource btn.sec}" />
  288. <Button
  289. Width="98"
  290. Height="32"
  291. Margin="124,0"
  292. HorizontalAlignment="Right"
  293. Command="{Binding InsertCommnad}"
  294. Content="{x:Static mainpage:MainPage.PageEdit_Insert}"
  295. Style="{StaticResource Btn.cta}" />
  296. </Grid>
  297. </cus:DialogContent.BottmBar>
  298. </cus:DialogContent>
  299. </UserControl>