OutLineControl.xaml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <UserControl x:Class="PDF_Office.Views.BOTA.OutLineControl"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
  7. xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl"
  8. xmlns:model="clr-namespace:PDF_Office.Model.BOTA"
  9. xmlns:bota="clr-namespace:PDF_Office.ViewModels.BOTA" d:DataContext="{d:DesignInstance Type=bota:OutLineControlViewModel}"
  10. mc:Ignorable="d"
  11. x:Name="ttt">
  12. <UserControl.Resources>
  13. <ResourceDictionary>
  14. <ResourceDictionary.MergedDictionaries>
  15. <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/OutLineItemStyle.xaml"/>
  16. </ResourceDictionary.MergedDictionaries>
  17. </ResourceDictionary>
  18. </UserControl.Resources>
  19. <Grid Background="Transparent">
  20. <Grid.RowDefinitions>
  21. <RowDefinition Height="40"/>
  22. <RowDefinition/>
  23. </Grid.RowDefinitions>
  24. <Grid x:Name="Header">
  25. <TextBlock x:Name="TxtTitle" Margin="12,0,0,0" HorizontalAlignment="Left"
  26. VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold" Text="Outline" />
  27. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
  28. <customcontrol:PathButton
  29. x:Name="BtnAdd"
  30. Click="BtnAdd_Click"
  31. Height="24" Width="24" IconHeight="20" IconWidth="20"
  32. Icon="{StaticResource Ic_AddButtonPath}" IconFill="Red"
  33. IconPress="{StaticResource Ic_AddButtonPath}" IconPressFill="#C04CF8"
  34. IconMouseOver="{StaticResource Ic_AddButtonPath}" IconMouseOverFill="#C04CF8" />
  35. <customcontrol:PathButton
  36. x:Name="BtnMore"
  37. Click="BtnMore_Click"
  38. Height="24" Width="24" IconHeight="20" IconWidth="20"
  39. Icon="{StaticResource Ic_MoreButtonPath}" IconFill="Red"
  40. IconPress="{StaticResource Ic_MoreButtonPath}" IconPressFill="#C04CF8"
  41. IconMouseOver="{StaticResource Ic_MoreButtonPath}" IconMouseOverFill="#C04CF8" >
  42. <customcontrol:PathButton.ContextMenu>
  43. <ContextMenu
  44. Name="MenuMore">
  45. <ContextMenu.ItemContainerStyle>
  46. <Style TargetType="MenuItem">
  47. <Setter Property="Padding" Value="-25,7,-40,7" />
  48. <Setter Property="VerticalContentAlignment" Value="Center" />
  49. </Style>
  50. </ContextMenu.ItemContainerStyle>
  51. <MenuItem
  52. Name="MenuDeleteAll"
  53. Command="{Binding DeleteAllCommand}"
  54. Header="Delete All Outline" />
  55. <MenuItem
  56. Name="MenuExpandAll"
  57. Command="{Binding ExpandAllCommand}"
  58. CommandParameter="{Binding Outlinelist}"
  59. Header="一键展开" />
  60. <MenuItem
  61. Name="MenuCollapseAll"
  62. Command="{Binding CollapseAllCommand}"
  63. CommandParameter="{Binding Outlinelist}"
  64. Header="一键折叠" />
  65. </ContextMenu>
  66. </customcontrol:PathButton.ContextMenu>
  67. </customcontrol:PathButton>
  68. </StackPanel>
  69. </Grid>
  70. <StackPanel Margin="10,0" x:Name="FirstOulineLine" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="{Binding IsInsertHead,Converter={StaticResource BoolToVisible}}">
  71. <Ellipse Width="8" Height="8" Fill="White" Stroke="#FF0078D7" StrokeThickness="1.5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/>
  72. <Rectangle Margin="-1,0,0,2" Width="{Binding ElementName=Header,Path=ActualWidth}" HorizontalAlignment="Stretch" Height="1.5" StrokeDashArray="2" VerticalAlignment="Bottom" Fill="#FF0078D7"/>
  73. </StackPanel>
  74. <Grid Grid.Row="1"
  75. DragOver="Grid_DragOver"
  76. DragLeave="Grid_DragLeave">
  77. <TreeView x:Name="OutlineView" Grid.Row="1" ItemsSource="{Binding Outlinelist}"
  78. BorderThickness="0" AllowDrop="True"
  79. VirtualizingPanel.ScrollUnit="Pixel"
  80. Drop="OutlineView_Drop"
  81. PreviewMouseMove="OutlineView_PreviewMouseMove"
  82. PreviewMouseLeftButtonUp="OutlineView_PreviewMouseLeftButtonUp"
  83. PreviewMouseDoubleClick="OutlineView_PreviewMouseDoubleClick"
  84. ScrollViewer.HorizontalScrollBarVisibility="Disabled">
  85. <TreeView.ItemTemplate>
  86. <HierarchicalDataTemplate DataType="{x:Type model:OutlineNode}" ItemsSource="{Binding Path=Chlidlist}">
  87. <Grid>
  88. <Grid.ContextMenu>
  89. <ContextMenu>
  90. <MenuItem x:Name="AddMenu" Click="AddMenu_Click" Header="添加条目"/>
  91. <MenuItem x:Name="AddChlidMenu" Click="AddChlidMenu_Click" Header="添加子条目"/>
  92. <MenuItem x:Name="AddParentMenu" Click="AddParentMenu_Click" Header="添加上一级条目" IsEnabled="{Binding CanAddParent}"/>
  93. <MenuItem x:Name="DeleteMenu" Click="DeleteMenu_Click" Header="删除"/>
  94. <MenuItem x:Name="RenameMenu" Click="RenameMenu_Click" Header="重命名"/>
  95. <MenuItem x:Name="ChangeDestinationMenu" Click="ChangeDestinationMenu_Click" Header="更改目标位置"/>
  96. <MenuItem x:Name="UpgradeMenu" Click="UpgradeMenu_Click" Header="升级" IsEnabled="{Binding CanUp}"/>
  97. <MenuItem x:Name="DowngradeMenu" Click="DowngradeMenu_Click" Header="降级" IsEnabled="{Binding CanDown}"/>
  98. </ContextMenu>
  99. </Grid.ContextMenu>
  100. <Grid x:Name="ContentPanel" >
  101. <Grid.ToolTip>
  102. <ToolTip Opened="ToolTip_Opened" Closed="ToolTip_Closed" >
  103. <customcontrol:CustomImageControl Width="400" Height="120" />
  104. </ToolTip>
  105. </Grid.ToolTip>
  106. <Grid.ColumnDefinitions>
  107. <ColumnDefinition />
  108. <ColumnDefinition Width="auto" />
  109. </Grid.ColumnDefinitions>
  110. <TextBlock x:Name="Content" Text="{Binding Outline.Title}" Visibility="{Binding IsReName,Mode=TwoWay}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/>
  111. <TextBlock x:Name="PageIndex" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding PageIndex}"/>
  112. </Grid>
  113. <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Visibility="{Binding IsInsertNextLayer, Converter={StaticResource BoolToVisible}}" >
  114. <Ellipse Margin="0,0,0,0" Width="8" Height="8" Fill="White" Stroke="#FF0078D7" StrokeThickness="1.5" VerticalAlignment="Bottom"/>
  115. <Line Margin="-1,0,0,2" X1="0" X2="{Binding ElementName=ContentPanel,Path=ActualWidth}" HorizontalAlignment="Stretch" StrokeThickness="1.5" StrokeDashArray="2" Stroke="#FF0078D7" VerticalAlignment="Bottom"/>
  116. </StackPanel>
  117. <Grid x:Name="RenameGrid"
  118. LostFocus="RenameGrid_LostFocus"
  119. Visibility="{Binding ElementName=Content,Path=Visibility,Mode=TwoWay,Converter={StaticResource UnVisivleConvert}}">
  120. <TextBox x:Name="ReName" HorizontalAlignment="Left" VerticalAlignment="Center"
  121. IsVisibleChanged="ReName_IsVisibleChanged"/>
  122. </Grid>
  123. </Grid>
  124. </HierarchicalDataTemplate>
  125. </TreeView.ItemTemplate>
  126. <TreeView.ItemContainerStyle>
  127. <Style BasedOn="{StaticResource OutLineItemStyle}" TargetType="TreeViewItem">
  128. <EventSetter Event="PreviewMouseLeftButtonUp" Handler="TreeViewItem_PreviewMouseLeftButtonUp"/>
  129. </Style>
  130. </TreeView.ItemContainerStyle>
  131. </TreeView>
  132. </Grid>
  133. </Grid>
  134. </UserControl>