WatermarkTemplateListTextContent.xaml 6.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <UserControl x:Class="PDF_Master.Views.EditTools.Watermark.WatermarkTemplateListTextContent"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:prism="http://prismlibrary.com/"
  5. prism:ViewModelLocator.AutoWireViewModel="True"
  6. xmlns:data ="clr-namespace:PDFSettings;assembly=PDFSettings"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. mc:Ignorable="d"
  10. d:DesignHeight="632"
  11. d:DesignWidth="260">
  12. <UserControl.Resources>
  13. <ContextMenu x:Key="FlyoutMenu" FontSize="14" >
  14. <ContextMenu.ItemContainerStyle>
  15. <Style TargetType="{x:Type MenuItem}">
  16. <Setter Property="Padding" Value="0,8,0,8"/>
  17. <Setter Property="VerticalContentAlignment" Value="Center"/>
  18. </Style>
  19. </ContextMenu.ItemContainerStyle>
  20. <MenuItem Name="MenuEdit" Header="编辑模板" Click="MenuEdit_Click" >
  21. </MenuItem>
  22. <MenuItem Name="MenuDeleteCurrent" Header="删除模板" Click="MenuDeleteCurrent_Click">
  23. </MenuItem>
  24. <MenuItem Name="MenuDeleteAll" Header="删除全部" Click="MenuDeleteAll_Click"></MenuItem>
  25. </ContextMenu>
  26. </UserControl.Resources>
  27. <Grid Background="#F3F3F3">
  28. <ListBox Name="TextWatermarkListbox"
  29. Width="240"
  30. BorderThickness="0"
  31. ScrollViewer.CanContentScroll="True"
  32. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  33. ScrollViewer.VerticalScrollBarVisibility="Hidden"
  34. VirtualizingPanel.IsVirtualizing="True"
  35. VirtualizingPanel.VirtualizationMode="Standard"
  36. VirtualizingPanel.CacheLengthUnit="Page"
  37. VirtualizingPanel.CacheLength="1"
  38. VirtualizingPanel.ScrollUnit="Pixel"
  39. Background="#F3F3F3"
  40. ItemsSource="{Binding WatermarkModTextCollection}"
  41. SelectionChanged="ListBox_SelectionChanged">
  42. <ListBox.ItemContainerStyle>
  43. <Style TargetType="ListBoxItem">
  44. <Setter Property="Margin" Value="20"/>
  45. <Setter Property="Padding" Value="0 0 0 0"/>
  46. <Setter Property="Height" Value="160"/>
  47. <Setter Property="Width" Value="128"/>
  48. <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
  49. <Setter Property="Template" Value="{DynamicResource EditToolsItemControlTemplate}"/>
  50. </Style>
  51. </ListBox.ItemContainerStyle>
  52. <ListBox.ItemTemplate>
  53. <DataTemplate DataType="{x:Type data:WatermarkItem}">
  54. <StackPanel Name="itemPanel" Loaded="itemPanel_Loaded">
  55. <Grid Height="160" Width=" 128">
  56. <Image Name="WatermarkPreview" Stretch="Fill" RenderOptions.BitmapScalingMode="HighQuality"/>
  57. <CheckBox Name="IsSelectedCheckBox" Height="14" Width="14" HorizontalAlignment="Right" VerticalAlignment="Top" Panel.ZIndex="1" IsChecked="True" IsEnabled="False"/>
  58. <Button Name="EditTemplateBtn" Height="43" Width="63" HorizontalAlignment="Left" VerticalAlignment="Bottom" Click="EditTemplateBtn_Click"></Button>
  59. <Button Name="DeleteTemplateBtn" Height="43" Width="63" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="DeleteTemplateBtn_Click" >
  60. </Button>
  61. </Grid>
  62. </StackPanel>
  63. <DataTemplate.Triggers>
  64. <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="True">
  65. <Setter TargetName="IsSelectedCheckBox" Property="Visibility" Value="Visible"/>
  66. </DataTrigger>
  67. <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="False">
  68. <Setter TargetName="IsSelectedCheckBox" Property="Visibility" Value="Collapsed"/>
  69. </DataTrigger>
  70. <Trigger Property="IsMouseOver" Value="True">
  71. <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Visible"/>
  72. <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Visible"/>
  73. </Trigger>
  74. <Trigger Property="IsMouseOver" Value="False">
  75. <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Collapsed"/>
  76. <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Collapsed"/>
  77. </Trigger>
  78. </DataTemplate.Triggers>
  79. </DataTemplate>
  80. </ListBox.ItemTemplate>
  81. </ListBox>
  82. <Grid Width="140" Margin="64,154,56,312" Visibility="{Binding CreateTemplateVisible, Mode=OneWay}">
  83. <StackPanel Orientation="Vertical">
  84. <Label Height="87" Width="87" HorizontalAlignment="Center" Background="BlueViolet"></Label>
  85. <TextBlock Height="24" FontSize="14" Text="请先创建一个水印模板" Margin="0,8,0,0" VerticalAlignment="Center" ></TextBlock>
  86. <Button Height="24" Width="44" Margin="0,12,0,0" Content ="新建" Command="{Binding AddTemplateCommand}"></Button>
  87. </StackPanel>
  88. </Grid>
  89. </Grid>
  90. </UserControl>