InsertDialog.xaml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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="480"
  15. Height="472"
  16. d:DataContext="{d:DesignInstance Type=pageeditdialogs:InsertDialogViewModel}"
  17. d:DesignHeight="450"
  18. d:DesignWidth="800"
  19. prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
  20. prism:ViewModelLocator.AutoWireViewModel="True"
  21. mc:Ignorable="d">
  22. <UserControl.Resources>
  23. <ResourceDictionary>
  24. <convert:FileToImageSourceConvert x:Key="FileToImageSourceConvert" />
  25. <DataTemplate x:Key="CustomItem" DataType="{x:Type model:CustomPageItem}">
  26. <StackPanel HorizontalAlignment="Center">
  27. <Border
  28. Name="BdBorder"
  29. Width="104"
  30. Height="64"
  31. BorderBrush="#A0A2AE"
  32. BorderThickness="1"
  33. CornerRadius="6">
  34. <Border.Background>
  35. <ImageBrush ImageSource="{Binding FilePath, Converter={StaticResource FileToImageSourceConvert}}" />
  36. </Border.Background>
  37. </Border>
  38. <Label
  39. Name="LbPageNum"
  40. Width="auto"
  41. Margin="0,4,0,0"
  42. HorizontalAlignment="Center"
  43. Background="Transparent"
  44. Content="{Binding Name}"
  45. FontSize="12" />
  46. </StackPanel>
  47. <DataTemplate.Triggers>
  48. <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
  49. <Setter TargetName="BdBorder" Property="BorderBrush" Value="#118AFF" />
  50. <Setter TargetName="BdBorder" Property="CornerRadius" Value="4" />
  51. <Setter TargetName="LbPageNum" Property="Foreground" Value="#118AFF" />
  52. </DataTrigger>
  53. </DataTemplate.Triggers>
  54. </DataTemplate>
  55. </ResourceDictionary>
  56. </UserControl.Resources>
  57. <cus:DialogContent Header="插入自定义页面">
  58. <cus:DialogContent.Content>
  59. <Grid>
  60. <Grid.RowDefinitions>
  61. <RowDefinition />
  62. <RowDefinition Height="auto" />
  63. <RowDefinition Height="auto" />
  64. </Grid.RowDefinitions>
  65. <ListBox
  66. Padding="0,16,0,0"
  67. HorizontalAlignment="Center"
  68. BorderThickness="0"
  69. ItemTemplate="{StaticResource CustomItem}"
  70. ItemsSource="{Binding Pages}"
  71. SelectedIndex="{Binding ItemSelectedIndex, Mode=TwoWay}">
  72. <ListBox.ItemContainerStyle>
  73. <Style TargetType="{x:Type ListBoxItem}">
  74. <Setter Property="Template" Value="{StaticResource ListBoxItemControlTemplate}" />
  75. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  76. </Style>
  77. </ListBox.ItemContainerStyle>
  78. <ListBox.ItemsPanel>
  79. <ItemsPanelTemplate>
  80. <WrapPanel />
  81. </ItemsPanelTemplate>
  82. </ListBox.ItemsPanel>
  83. </ListBox>
  84. <StackPanel Grid.Row="1" Margin="16,0">
  85. <TextBlock
  86. FontSize="14"
  87. FontWeight="SemiBold"
  88. Text="页面大小" />
  89. <StackPanel
  90. Margin="0,12,0,0"
  91. VerticalAlignment="Bottom"
  92. Orientation="Horizontal">
  93. <RadioButton
  94. Height="32"
  95. VerticalContentAlignment="Center"
  96. Content="当前页"
  97. GroupName="PageSize"
  98. IsChecked="{Binding IsCurrentSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  99. <Label
  100. Height="32"
  101. Margin="8,0"
  102. HorizontalAlignment="Center"
  103. VerticalContentAlignment="Center"
  104. Content="{Binding CurrentPageSize}"
  105. FontSize="14" />
  106. </StackPanel>
  107. <StackPanel Margin="0,12" Orientation="Horizontal">
  108. <RadioButton
  109. Name="RbtnStandard"
  110. VerticalAlignment="Center"
  111. Content="标准"
  112. GroupName="PageSize"
  113. IsChecked="{Binding IsStandSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  114. <ComboBox
  115. Width="228"
  116. Height="32"
  117. Margin="8,0"
  118. IsEnabled="{Binding ElementName=RbtnStandard, Path=IsChecked}"
  119. ItemsSource="{Binding PageSize}"
  120. SelectedIndex="{Binding PageSizeSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  121. </StackPanel>
  122. <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
  123. <RadioButton
  124. Name="RbtnCustom"
  125. VerticalAlignment="Center"
  126. Content="自定义"
  127. GroupName="PageSize"
  128. IsChecked="{Binding IsCustomSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  129. <TextBox
  130. Width="80"
  131. Height="32"
  132. Margin="8,0"
  133. VerticalContentAlignment="Center"
  134. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  135. Text="{Binding CustomWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  136. <TextBlock VerticalAlignment="Center" Text="X" />
  137. <TextBox
  138. Width="80"
  139. Height="32"
  140. Margin="8,0"
  141. VerticalContentAlignment="Center"
  142. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  143. Text="{Binding CustomHeight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  144. <ComboBox
  145. Width="80"
  146. VerticalContentAlignment="Center"
  147. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  148. ItemsSource="{Binding Units}"
  149. SelectedIndex="{Binding UnitsSelectedIndex}" />
  150. </StackPanel>
  151. </StackPanel>
  152. <StackPanel Grid.Row="2" Margin="16,0">
  153. <TextBlock
  154. FontSize="14"
  155. FontWeight="SemiBold"
  156. Text="方向" />
  157. <StackPanel Orientation="Horizontal">
  158. <RadioButton
  159. Margin="0,12,0,16"
  160. Content="纵向页面"
  161. IsChecked="{Binding IsVerticalSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  162. <RadioButton
  163. Margin="24,12,0,16"
  164. Content="横向页面"
  165. IsChecked="{Binding IsHorizontalSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  166. Tag="Vertical" />
  167. </StackPanel>
  168. </StackPanel>
  169. </Grid>
  170. </cus:DialogContent.Content>
  171. <cus:DialogContent.BottmBar>
  172. <Grid>
  173. <Button
  174. Width="98"
  175. Height="32"
  176. Margin="16,0"
  177. HorizontalAlignment="Right"
  178. Command="{Binding CancelCommand}"
  179. Content="取消" />
  180. <Button
  181. Width="98"
  182. Height="32"
  183. Margin="124,0"
  184. HorizontalAlignment="Right"
  185. Command="{Binding InsertCommnad}"
  186. Content="插入" />
  187. </Grid>
  188. </cus:DialogContent.BottmBar>
  189. </cus:DialogContent>
  190. </UserControl>