HeaderFooterTemplateListContent.xaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <UserControl x:Class="PDF_Master.Views.EditTools.HeaderFooter.HeaderFooterTemplateListContent"
  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. xmlns:data ="clr-namespace:PDFSettings;assembly=PDFSettings"
  6. prism:ViewModelLocator.AutoWireViewModel="True"
  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="720"
  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>
  28. <Grid.RowDefinitions>
  29. <RowDefinition Height="40"></RowDefinition>
  30. <RowDefinition></RowDefinition>
  31. </Grid.RowDefinitions>
  32. <Grid Grid.Row="0">
  33. <TextBlock Width="64" Height="24" Text="页眉页脚" FontSize="16" Margin="16,0,16,0" HorizontalAlignment="Left"></TextBlock>
  34. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
  35. <!--<Button Height="20" Width="20"></Button>-->
  36. <Button Height="22" Width="22" Margin="16,0,6,0" Command="{Binding EnterCreateCommand}" BorderThickness="0" Background="Transparent">
  37. <Grid VerticalAlignment="Center" HorizontalAlignment="Center">
  38. <Ellipse Width="20" Height="20" Stroke="black" StrokeThickness="2"/>
  39. <Path Data="M6 10H14M10 6V14" Stroke="black" StrokeThickness="2" StrokeStartLineCap="Round" StrokeLineJoin="Round"/>
  40. </Grid>
  41. </Button>
  42. </StackPanel>
  43. </Grid>
  44. <Grid Background="#F3F3F3" Grid.Row="1">
  45. <ListBox
  46. Width="260"
  47. BorderThickness="0"
  48. ScrollViewer.CanContentScroll="True"
  49. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  50. ScrollViewer.VerticalScrollBarVisibility="Hidden"
  51. VirtualizingPanel.IsVirtualizing="True"
  52. VirtualizingPanel.VirtualizationMode="Standard"
  53. VirtualizingPanel.CacheLengthUnit="Page"
  54. VirtualizingPanel.CacheLength="1"
  55. VirtualizingPanel.ScrollUnit="Pixel"
  56. Background="#F3F3F3"
  57. ItemsSource="{Binding HeaderFooterModCollection}"
  58. SelectionChanged="ListBox_SelectionChanged">
  59. <ListBox.ItemContainerStyle>
  60. <Style TargetType="ListBoxItem">
  61. <Setter Property="Margin" Value="11,0,0,0"/>
  62. <Setter Property="Padding" Value="0 0 0 0"/>
  63. <Setter Property="Width" Value="238"/>
  64. <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
  65. <Setter Property="Template" Value="{DynamicResource EditToolsItemControlTemplate}"/>
  66. </Style>
  67. </ListBox.ItemContainerStyle>
  68. <ListBox.ItemTemplate>
  69. <DataTemplate DataType="{x:Type data:BatesHeaderFooterItem}">
  70. <StackPanel Name="itemPanel" Loaded="itemPanel_Loaded">
  71. <Border BorderThickness="1" BorderBrush="#A0A2AE">
  72. <Grid Width="238" HorizontalAlignment="Left">
  73. <StackPanel >
  74. <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
  75. <TextBlock Text="页眉页脚名称" Height="22" Width="98" FontSize="14" FontWeight="Black"></TextBlock>
  76. <TextBlock Name="TemplateIndexTextBox" FontSize="14" Width="120"></TextBlock>
  77. </StackPanel>
  78. <StackPanel Orientation="Horizontal" Margin="0,8,0,0" Visibility="{Binding ElementName=LeftHeaderTextBox,Path=Visibility}">
  79. <TextBlock Text="左侧页眉:" FontSize="14" Height="22" Width="70"></TextBlock>
  80. <TextBlock Name="LeftHeaderTextBox" FontSize="14" Margin="8,0,0,0" Width="149" Height="22" ></TextBlock>
  81. </StackPanel>
  82. <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=RightHeaderTextBox,Path=Visibility}">
  83. <TextBlock Text="右侧页眉:" FontSize="14" Height="22" Width="70"></TextBlock>
  84. <TextBlock Name="RightHeaderTextBox" FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
  85. </StackPanel>
  86. <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=CenterHeaderTextBox,Path=Visibility}">
  87. <TextBlock Text="中间页眉:" FontSize="14" Height="22" Width="70"></TextBlock>
  88. <TextBlock Name="CenterHeaderTextBox" FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
  89. </StackPanel>
  90. <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=LeftFooterTextBox,Path=Visibility}">
  91. <TextBlock Text="左侧页脚:" FontSize="14" Height="22" Width="70"></TextBlock>
  92. <TextBlock Name="LeftFooterTextBox" FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
  93. </StackPanel>
  94. <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=RightFooterTextBox,Path=Visibility}">
  95. <TextBlock Text="右侧页脚:" FontSize="14" Height="22" Width="70"></TextBlock>
  96. <TextBlock Name="RightFooterTextBox" FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
  97. </StackPanel>
  98. <StackPanel Orientation="Horizontal" Margin="0,4,0,0" Visibility="{Binding ElementName=CenterFooterTextBox,Path=Visibility}">
  99. <TextBlock Text="中间页脚:" FontSize="14" Height="22" Width="70"></TextBlock>
  100. <TextBlock Name="CenterFooterTextBox" FontSize="14" Margin="8,0,0,0" Width="149" Height="22"></TextBlock>
  101. </StackPanel>
  102. </StackPanel>
  103. <CheckBox Name="IsSelectedCheckBox" Height="14" Width="14" HorizontalAlignment="Right" VerticalAlignment="Top" Panel.ZIndex="1" IsChecked="True" IsEnabled="False"/>
  104. <Button Name="EditTemplateBtn" Height="43" Width="63" HorizontalAlignment="Left" VerticalAlignment="Bottom" Click="EditTemplateBtn_Click"></Button>
  105. <Button Name="DeleteTemplateBtn" Height="43" Width="63" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="DeleteTemplateBtn_Click">
  106. </Button>
  107. </Grid>
  108. </Border>
  109. </StackPanel>
  110. <DataTemplate.Triggers>
  111. <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="True">
  112. <Setter TargetName="IsSelectedCheckBox" Property="Visibility" Value="Visible"/>
  113. </DataTrigger>
  114. <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="False">
  115. <Setter TargetName="IsSelectedCheckBox" Property="Visibility" Value="Collapsed"/>
  116. </DataTrigger>
  117. <Trigger Property="IsMouseOver" Value="True">
  118. <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Visible"/>
  119. <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Visible"/>
  120. </Trigger>
  121. <Trigger Property="IsMouseOver" Value="False">
  122. <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Collapsed"/>
  123. <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Collapsed"/>
  124. </Trigger>
  125. </DataTemplate.Triggers>
  126. </DataTemplate>
  127. </ListBox.ItemTemplate>
  128. </ListBox>
  129. <Grid Width="140" Margin="64,153,56,0" Visibility="{Binding CreateTemplateVisible, Mode=OneWay}">
  130. <StackPanel Orientation="Vertical">
  131. <Label Height="87" Width="87" HorizontalAlignment="Center" Background="BlueViolet"></Label>
  132. <TextBlock Height="24" FontSize="14" Text="请先创建一个页眉页脚模板" Margin="0,8,0,0" VerticalAlignment="Center" ></TextBlock>
  133. <Button Height="24" Width="44" Margin="0,12,0,0" Content ="新建" Command="{Binding AddTemplateCommand}"></Button>
  134. </StackPanel>
  135. </Grid>
  136. </Grid>
  137. </Grid>
  138. </UserControl>