InsertDialog.xaml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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="380"
  15. Height="350"
  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}" Visibility="Hidden">
  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="0" 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. IsEnabled="{Binding IsCurrentIsEnabled,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  99. IsChecked="{Binding IsCurrentSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  100. <Label
  101. Height="32"
  102. Margin="8,0"
  103. HorizontalAlignment="Center"
  104. VerticalContentAlignment="Center"
  105. Content="{Binding CurrentPageSize}"
  106. FontSize="14" />
  107. </StackPanel>
  108. <StackPanel Margin="0,12" Orientation="Horizontal">
  109. <RadioButton
  110. Name="RbtnStandard"
  111. VerticalAlignment="Center"
  112. Content="标准"
  113. GroupName="PageSize"
  114. IsChecked="{Binding IsStandSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  115. <ComboBox
  116. Width="228"
  117. Height="32"
  118. Margin="8,0"
  119. IsEnabled="{Binding ElementName=RbtnStandard, Path=IsChecked}"
  120. ItemsSource="{Binding PageSize}"
  121. SelectedIndex="{Binding PageSizeSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  122. </StackPanel>
  123. <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
  124. <RadioButton
  125. Name="RbtnCustom"
  126. VerticalAlignment="Center"
  127. Content="自定义"
  128. GroupName="PageSize"
  129. IsChecked="{Binding IsCustomSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  130. <TextBox
  131. Width="80"
  132. Height="32"
  133. Margin="8,0"
  134. VerticalContentAlignment="Center"
  135. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  136. Text="{Binding CustomWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  137. <TextBlock VerticalAlignment="Center" Text="X" />
  138. <TextBox
  139. Width="80"
  140. Height="32"
  141. Margin="8,0"
  142. VerticalContentAlignment="Center"
  143. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  144. Text="{Binding CustomHeight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  145. <ComboBox
  146. Width="80"
  147. VerticalContentAlignment="Center"
  148. IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
  149. ItemsSource="{Binding Units}"
  150. SelectedIndex="{Binding UnitsSelectedIndex}" />
  151. </StackPanel>
  152. </StackPanel>
  153. <StackPanel Grid.Row="1" Margin="16,0">
  154. <TextBlock
  155. FontSize="14"
  156. FontWeight="SemiBold"
  157. Text="方向" />
  158. <StackPanel Orientation="Horizontal">
  159. <RadioButton
  160. Margin="0,12,0,16"
  161. Content="纵向页面"
  162. IsChecked="{Binding IsVerticalSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  163. Tag="Vertical"
  164. GroupName="Direction"/>
  165. <RadioButton
  166. Margin="24,12,0,16"
  167. Content="横向页面"
  168. IsChecked="{Binding IsHorizontalSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  169. Tag="Horizontal"
  170. GroupName="Direction"/>
  171. </StackPanel>
  172. </StackPanel>
  173. </Grid>
  174. </cus:DialogContent.Content>
  175. <cus:DialogContent.BottmBar>
  176. <Grid>
  177. <Button
  178. Width="98"
  179. Height="32"
  180. Margin="16,0"
  181. HorizontalAlignment="Right"
  182. Command="{Binding CancelCommand}"
  183. Content="取消" />
  184. <Button
  185. Width="98"
  186. Height="32"
  187. Margin="124,0"
  188. HorizontalAlignment="Right"
  189. Command="{Binding InsertCommnad}"
  190. Content="插入" />
  191. </Grid>
  192. </cus:DialogContent.BottmBar>
  193. </cus:DialogContent>
  194. </UserControl>