BackgroundTemplateListFileContent.xaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <UserControl x:Class="PDF_Office.Views.EditTools.Background.BackgroundTemplateListFileContent"
  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" xmlns:background="clr-namespace:PDF_Office.ViewModels.EditTools.Background" d:DataContext="{d:DesignInstance Type=background:BackgroundTemplateListFileContentViewModel}"
  9. mc:Ignorable="d"
  10. d:DesignHeight="632"
  11. d:DesignWidth="260">
  12. <Grid Background="#F3F3F3">
  13. <ListBox Name="TextWatermarkListbox"
  14. Width="240"
  15. BorderThickness="0"
  16. ScrollViewer.CanContentScroll="True"
  17. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  18. ScrollViewer.VerticalScrollBarVisibility="Hidden"
  19. VirtualizingPanel.IsVirtualizing="True"
  20. VirtualizingPanel.VirtualizationMode="Standard"
  21. VirtualizingPanel.CacheLengthUnit="Page"
  22. VirtualizingPanel.CacheLength="1"
  23. VirtualizingPanel.ScrollUnit="Pixel"
  24. Background="#F3F3F3"
  25. ItemsSource="{Binding BackgroundModFileCollection}">
  26. <ListBox.ItemContainerStyle>
  27. <Style TargetType="ListBoxItem">
  28. <Setter Property="Margin" Value="0"/>
  29. <Setter Property="Padding" Value="8 0 8 0"/>
  30. <!--<Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>-->
  31. <Setter Property="Template" Value="{DynamicResource ListBoxItemControlTemplate}"/>
  32. </Style>
  33. </ListBox.ItemContainerStyle>
  34. <ListBox.ItemTemplate>
  35. <DataTemplate DataType="{x:Type data:BackgroundItem}">
  36. <StackPanel Name="itemPanel" >
  37. <Grid Height="160" Width=" 128" Background="Blue">
  38. <Label Height="160" Width=" 128"></Label>
  39. <Label Height="160" Width=" 128"></Label>
  40. <Button Name="EditTemplateBtn" Height="43" Width="63" HorizontalAlignment="Left" VerticalAlignment="Bottom"></Button>
  41. <Button Name="DeleteTemplateBtn" Height="43" Width="63" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="DeleteTemplateBtn_Click" Command="{Binding DeleteTemplateItemCommand}" CommandParameter="{Binding ElementName=DeleteTemplateBtn}">
  42. </Button>
  43. </Grid>
  44. </StackPanel>
  45. <DataTemplate.Triggers>
  46. <Trigger Property="IsMouseOver" Value="True">
  47. <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Visible"/>
  48. <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Visible"/>
  49. </Trigger>
  50. <Trigger Property="IsMouseOver" Value="False">
  51. <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Collapsed"/>
  52. <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Collapsed"/>
  53. </Trigger>
  54. </DataTemplate.Triggers>
  55. </DataTemplate>
  56. </ListBox.ItemTemplate>
  57. </ListBox>
  58. <Grid Width="140" Height="155" Margin="64,153,56,324" Visibility="{Binding CreateTemplateVisible, Mode=OneWay}">
  59. <StackPanel Orientation="Vertical">
  60. <Label Height="87" Width="87" HorizontalAlignment="Center" Background="BlueViolet"></Label>
  61. <TextBlock Height="24" FontSize="14" Text="请先创建一个背景模板" Margin="0,8,0,0" VerticalAlignment="Center" ></TextBlock>
  62. <Button Height="24" Width="44" Margin="0,12,0,0" Content ="新建" Command="{Binding AddTemplateCommand}"></Button>
  63. </StackPanel>
  64. </Grid>
  65. </Grid>
  66. </UserControl>