InsertDialog.xaml 15 KB

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