InsertDialog.xaml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <UserControl
  2. x:Class="PDF_Office.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_Office.DataConvert"
  6. xmlns:cus="clr-namespace:PDF_Office.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_Office.Views.Dialog.PageEditDialogs"
  10. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  11. xmlns:model="clr-namespace:PDF_Office.Model.PageEdit"
  12. xmlns:pageeditdialogs="clr-namespace:PDF_Office.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="True" />
  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. <ComboBox
  114. Width="228"
  115. Height="32"
  116. Margin="8,0"
  117. IsEnabled="{Binding ElementName=RbtnStandard, Path=IsChecked}" />
  118. </StackPanel>
  119. <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
  120. <RadioButton
  121. Name="RbtnCustom"
  122. VerticalAlignment="Center"
  123. Content="自定义"
  124. GroupName="PageSize" />
  125. <TextBox
  126. Width="80"
  127. Height="32"
  128. Margin="8,0"
  129. VerticalContentAlignment="Center"
  130. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  131. Text="{Binding CustomWidth, Mode=TwoWay}" />
  132. <TextBlock VerticalAlignment="Center" Text="X" />
  133. <TextBox
  134. Width="80"
  135. Height="32"
  136. Margin="8,0"
  137. VerticalContentAlignment="Center"
  138. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  139. Text="{Binding CustomHeight, Mode=TwoWay}" />
  140. <ComboBox
  141. Width="80"
  142. VerticalContentAlignment="Center"
  143. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  144. ItemsSource="{Binding Units}"
  145. SelectedIndex="{Binding UnitsSelectedIndex}" />
  146. </StackPanel>
  147. </StackPanel>
  148. <StackPanel Grid.Row="2" Margin="16,0">
  149. <TextBlock
  150. FontSize="14"
  151. FontWeight="SemiBold"
  152. Text="方向" />
  153. <StackPanel Orientation="Horizontal">
  154. <RadioButton
  155. Margin="0,12,0,16"
  156. Content="纵向页面"
  157. IsChecked="True">
  158. <i:Interaction.Triggers>
  159. <i:EventTrigger EventName="Checked">
  160. <i:InvokeCommandAction Command="{Binding OrientationCheckedCommand}" CommandParameter="Vertical" />
  161. </i:EventTrigger>
  162. </i:Interaction.Triggers>
  163. </RadioButton>
  164. <RadioButton
  165. Margin="24,12,0,16"
  166. Content="横向页面"
  167. Tag="Vertical">
  168. <i:Interaction.Triggers>
  169. <i:EventTrigger EventName="Checked">
  170. <i:InvokeCommandAction Command="{Binding OrientationCheckedCommand}" CommandParameter="Horizontal" />
  171. </i:EventTrigger>
  172. </i:Interaction.Triggers>
  173. </RadioButton>
  174. </StackPanel>
  175. </StackPanel>
  176. </Grid>
  177. </cus:DialogContent.Content>
  178. <cus:DialogContent.BottmBar>
  179. <Grid>
  180. <Button
  181. Width="98"
  182. Height="32"
  183. Margin="16,0"
  184. HorizontalAlignment="Right"
  185. Command="{Binding CancelCommand}"
  186. Content="取消" />
  187. <Button
  188. Width="98"
  189. Height="32"
  190. Margin="124,0"
  191. HorizontalAlignment="Right"
  192. Command="{Binding InsertCommnad}"
  193. Content="插入" />
  194. </Grid>
  195. </cus:DialogContent.BottmBar>
  196. </cus:DialogContent>
  197. </UserControl>