InsertDialog.xaml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. <Image
  29. Width="208"
  30. Height="230"
  31. Source="{Binding FilePath, Converter={StaticResource FileToImageSourceConvert}}" />
  32. </Border>
  33. <Label
  34. Width="auto"
  35. Margin="0,4,0,0"
  36. Content="{Binding Name}"
  37. FontSize="12" />
  38. </StackPanel>
  39. </DataTemplate>
  40. </ResourceDictionary>
  41. </UserControl.Resources>
  42. <cus:DialogContent Header="插入自定义页面">
  43. <cus:DialogContent.Content>
  44. <Grid>
  45. <Grid.RowDefinitions>
  46. <RowDefinition />
  47. <RowDefinition Height="auto" />
  48. <RowDefinition Height="auto" />
  49. </Grid.RowDefinitions>
  50. <ListBox
  51. BorderThickness="0"
  52. ItemTemplate="{StaticResource CustomItem}"
  53. ItemsSource="{Binding Pages}"
  54. SelectedIndex="{Binding ItemSelectedIndex, Mode=TwoWay}">
  55. <ListBox.ItemsPanel>
  56. <ItemsPanelTemplate>
  57. <WrapPanel />
  58. </ItemsPanelTemplate>
  59. </ListBox.ItemsPanel>
  60. </ListBox>
  61. <StackPanel Grid.Row="1" Margin="16,0">
  62. <TextBlock
  63. FontSize="14"
  64. FontWeight="SemiBold"
  65. Text="页面大小" />
  66. <StackPanel
  67. Margin="0,12,0,0"
  68. VerticalAlignment="Bottom"
  69. Orientation="Horizontal">
  70. <RadioButton
  71. Height="32"
  72. VerticalContentAlignment="Center"
  73. Content="当前页"
  74. GroupName="PageSize"
  75. IsChecked="True" />
  76. <Label
  77. Height="32"
  78. Margin="8,0"
  79. HorizontalAlignment="Center"
  80. VerticalContentAlignment="Center"
  81. Content="{Binding CurrentPageSize}"
  82. FontSize="14" />
  83. </StackPanel>
  84. <StackPanel Margin="0,12" Orientation="Horizontal">
  85. <RadioButton
  86. VerticalAlignment="Center"
  87. Content="标准"
  88. GroupName="PageSize" />
  89. <ComboBox
  90. Width="228"
  91. Height="32"
  92. Margin="8,0" />
  93. </StackPanel>
  94. <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
  95. <RadioButton
  96. VerticalAlignment="Center"
  97. Content="自定义"
  98. GroupName="PageSize" />
  99. <TextBox
  100. Width="80"
  101. Height="32"
  102. Margin="8,0"
  103. VerticalAlignment="Center"
  104. Text="{Binding CustomWidth, Mode=TwoWay}" />
  105. <TextBlock VerticalAlignment="Center" Text="X" />
  106. <TextBox
  107. Width="80"
  108. Height="32"
  109. Margin="8,0"
  110. VerticalAlignment="Center"
  111. Text="{Binding CustomHeight, Mode=TwoWay}" />
  112. <ComboBox Width="80" />
  113. </StackPanel>
  114. </StackPanel>
  115. <StackPanel Grid.Row="2" Margin="16,0">
  116. <TextBlock
  117. FontSize="14"
  118. FontWeight="SemiBold"
  119. Text="方向" />
  120. <StackPanel Orientation="Horizontal">
  121. <RadioButton
  122. Margin="0,12,0,16"
  123. Content="纵向页面"
  124. IsChecked="True">
  125. <i:Interaction.Triggers>
  126. <i:EventTrigger EventName="Checked">
  127. <i:InvokeCommandAction Command="{Binding OrientationCheckedCommand}" CommandParameter="Vertical" />
  128. </i:EventTrigger>
  129. </i:Interaction.Triggers>
  130. </RadioButton>
  131. <RadioButton
  132. Margin="24,12,0,16"
  133. Content="横向页面"
  134. Tag="Vertical">
  135. <i:Interaction.Triggers>
  136. <i:EventTrigger EventName="Checked">
  137. <i:InvokeCommandAction Command="{Binding OrientationCheckedCommand}" CommandParameter="Horizontal" />
  138. </i:EventTrigger>
  139. </i:Interaction.Triggers>
  140. </RadioButton>
  141. </StackPanel>
  142. </StackPanel>
  143. </Grid>
  144. </cus:DialogContent.Content>
  145. <cus:DialogContent.BottmBar>
  146. <Grid>
  147. <Button
  148. Width="98"
  149. Height="32"
  150. Margin="16,0"
  151. HorizontalAlignment="Right"
  152. Command="{Binding CancelCommand}"
  153. Content="取消" />
  154. <Button
  155. Width="98"
  156. Height="32"
  157. Margin="124,0"
  158. HorizontalAlignment="Right"
  159. Command="{Binding InsertCommnad}"
  160. Content="插入" />
  161. </Grid>
  162. </cus:DialogContent.BottmBar>
  163. </cus:DialogContent>
  164. </UserControl>