|
@@ -1,47 +1,66 @@
|
|
|
-<UserControl x:Class="PDF_Office.Views.BOTA.OutLineControl"
|
|
|
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
- xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
|
|
|
- xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl"
|
|
|
- xmlns:model="clr-namespace:PDF_Office.Model.BOTA"
|
|
|
- xmlns:bota="clr-namespace:PDF_Office.ViewModels.BOTA" d:DataContext="{d:DesignInstance Type=bota:OutLineControlViewModel}"
|
|
|
- mc:Ignorable="d"
|
|
|
- x:Name="ttt">
|
|
|
+<UserControl
|
|
|
+ x:Class="PDF_Office.Views.BOTA.OutLineControl"
|
|
|
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
+ xmlns:bota="clr-namespace:PDF_Office.ViewModels.BOTA"
|
|
|
+ xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl"
|
|
|
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
+ xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
|
|
|
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
+ xmlns:model="clr-namespace:PDF_Office.Model.BOTA"
|
|
|
+ x:Name="ttt"
|
|
|
+ d:DataContext="{d:DesignInstance Type=bota:OutLineControlViewModel}"
|
|
|
+ mc:Ignorable="d">
|
|
|
<UserControl.Resources>
|
|
|
<ResourceDictionary>
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
|
- <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/OutLineItemStyle.xaml"/>
|
|
|
+ <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/OutLineItemStyle.xaml" />
|
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
</ResourceDictionary>
|
|
|
</UserControl.Resources>
|
|
|
- <Grid Background="Transparent">
|
|
|
+ <Grid Background="Transparent">
|
|
|
<Grid.RowDefinitions>
|
|
|
- <RowDefinition Height="40"/>
|
|
|
- <RowDefinition/>
|
|
|
+ <RowDefinition Height="40" />
|
|
|
+ <RowDefinition />
|
|
|
</Grid.RowDefinitions>
|
|
|
<Grid x:Name="Header">
|
|
|
- <TextBlock x:Name="TxtTitle" Margin="12,0,0,0" HorizontalAlignment="Left"
|
|
|
- VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold" Text="Outline" />
|
|
|
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
|
|
+ <TextBlock
|
|
|
+ x:Name="TxtTitle"
|
|
|
+ Margin="12,0,0,0"
|
|
|
+ HorizontalAlignment="Left"
|
|
|
+ VerticalAlignment="Center"
|
|
|
+ FontSize="18"
|
|
|
+ FontWeight="SemiBold"
|
|
|
+ Text="Outline" />
|
|
|
+ <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
|
|
<customcontrol:PathButton
|
|
|
- x:Name="BtnAdd"
|
|
|
- Click="BtnAdd_Click"
|
|
|
- Height="24" Width="24" IconHeight="20" IconWidth="20"
|
|
|
- Icon="{StaticResource Ic_AddButtonPath}" IconFill="#616469"
|
|
|
- IconPress="{StaticResource Ic_AddButtonPath}" IconPressFill="#616469"
|
|
|
- IconMouseOver="{StaticResource Ic_AddButtonPath}" IconMouseOverFill="#616469" />
|
|
|
+ x:Name="BtnAdd"
|
|
|
+ Width="24"
|
|
|
+ Height="24"
|
|
|
+ Click="BtnAdd_Click"
|
|
|
+ Icon="{StaticResource Ic_AddButtonPath}"
|
|
|
+ IconFill="#616469"
|
|
|
+ IconHeight="20"
|
|
|
+ IconMouseOver="{StaticResource Ic_AddButtonPath}"
|
|
|
+ IconMouseOverFill="#616469"
|
|
|
+ IconPress="{StaticResource Ic_AddButtonPath}"
|
|
|
+ IconPressFill="#616469"
|
|
|
+ IconWidth="20" />
|
|
|
<customcontrol:PathButton
|
|
|
- x:Name="BtnMore"
|
|
|
- Click="BtnMore_Click"
|
|
|
- Height="24" Width="24" IconHeight="20" IconWidth="20"
|
|
|
- Icon="{StaticResource Ic_MoreButtonPath}" IconFill="#616469"
|
|
|
- IconPress="{StaticResource Ic_MoreButtonPath}" IconPressFill="#616469"
|
|
|
- IconMouseOver="{StaticResource Ic_MoreButtonPath}" IconMouseOverFill="#616469" >
|
|
|
+ x:Name="BtnMore"
|
|
|
+ Width="24"
|
|
|
+ Height="24"
|
|
|
+ Click="BtnMore_Click"
|
|
|
+ Icon="{StaticResource Ic_MoreButtonPath}"
|
|
|
+ IconFill="#616469"
|
|
|
+ IconHeight="20"
|
|
|
+ IconMouseOver="{StaticResource Ic_MoreButtonPath}"
|
|
|
+ IconMouseOverFill="#616469"
|
|
|
+ IconPress="{StaticResource Ic_MoreButtonPath}"
|
|
|
+ IconPressFill="#616469"
|
|
|
+ IconWidth="20">
|
|
|
<customcontrol:PathButton.ContextMenu>
|
|
|
- <ContextMenu
|
|
|
- Name="MenuMore">
|
|
|
+ <ContextMenu Name="MenuMore">
|
|
|
<ContextMenu.ItemContainerStyle>
|
|
|
<Style TargetType="MenuItem">
|
|
|
<Setter Property="Padding" Value="-25,7,-40,7" />
|
|
@@ -59,7 +78,7 @@
|
|
|
Header="一键展开" />
|
|
|
<MenuItem
|
|
|
Name="MenuCollapseAll"
|
|
|
- Command="{Binding CollapseAllCommand}"
|
|
|
+ Command="{Binding CollapseAllCommand}"
|
|
|
CommandParameter="{Binding Outlinelist}"
|
|
|
Header="一键折叠" />
|
|
|
</ContextMenu>
|
|
@@ -68,81 +87,188 @@
|
|
|
</StackPanel>
|
|
|
</Grid>
|
|
|
|
|
|
- <StackPanel Margin="10,0" x:Name="FirstOulineLine" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="{Binding IsInsertHead,Converter={StaticResource BoolToVisible}}">
|
|
|
- <Ellipse Width="8" Height="8" Fill="White" Stroke="#FF0078D7" StrokeThickness="1.5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/>
|
|
|
- <Rectangle Margin="-1,0,0,2" Width="{Binding ElementName=Header,Path=ActualWidth}" HorizontalAlignment="Stretch" Height="1.5" StrokeDashArray="2" VerticalAlignment="Bottom" Fill="#FF0078D7"/>
|
|
|
+ <StackPanel
|
|
|
+ x:Name="FirstOulineLine"
|
|
|
+ Margin="10,0"
|
|
|
+ VerticalAlignment="Bottom"
|
|
|
+ Orientation="Horizontal"
|
|
|
+ Visibility="{Binding IsInsertHead, Converter={StaticResource BoolToVisible}}">
|
|
|
+ <Ellipse
|
|
|
+ Width="8"
|
|
|
+ Height="8"
|
|
|
+ HorizontalAlignment="Stretch"
|
|
|
+ VerticalAlignment="Bottom"
|
|
|
+ Fill="White"
|
|
|
+ Stroke="#FF0078D7"
|
|
|
+ StrokeThickness="1.5" />
|
|
|
+ <Rectangle
|
|
|
+ Width="{Binding ElementName=Header, Path=ActualWidth}"
|
|
|
+ Height="1.5"
|
|
|
+ Margin="-1,0,0,2"
|
|
|
+ HorizontalAlignment="Stretch"
|
|
|
+ VerticalAlignment="Bottom"
|
|
|
+ Fill="#FF0078D7"
|
|
|
+ StrokeDashArray="2" />
|
|
|
</StackPanel>
|
|
|
- <Grid Grid.Row="1"
|
|
|
- DragOver="Grid_DragOver"
|
|
|
- DragLeave="Grid_DragLeave">
|
|
|
- <StackPanel VerticalAlignment="Center" x:Name="NoOutlineStackPanel" Visibility="{Binding Outlinelist.Count, Converter={StaticResource ListCountToVisible}}">
|
|
|
+ <Grid
|
|
|
+ Grid.Row="1"
|
|
|
+ DragLeave="Grid_DragLeave"
|
|
|
+ DragOver="Grid_DragOver">
|
|
|
+ <StackPanel
|
|
|
+ x:Name="NoOutlineStackPanel"
|
|
|
+ VerticalAlignment="Center"
|
|
|
+ Visibility="{Binding Outlinelist.Count, Converter={StaticResource ListCountToVisible}}">
|
|
|
<Image Source="pack://application:,,,/PDF Office;component/Resources/BOTA/no_outline.png" />
|
|
|
- <TextBlock Text="No outline found" FontSize="14" FontFamily="Segoe UI" Height="22" HorizontalAlignment="Center"/>
|
|
|
- <TextBlock Text="Please right-click on the selected page and select Add Outline, or click the Add button on the upper right to create a outline." Width="168" FontSize="12" FontFamily="Segoe UI" TextWrapping="Wrap" Foreground="#94989C" HorizontalAlignment="Center"/>
|
|
|
+ <TextBlock
|
|
|
+ Height="22"
|
|
|
+ HorizontalAlignment="Center"
|
|
|
+ FontFamily="Segoe UI"
|
|
|
+ FontSize="14"
|
|
|
+ Text="No outline found" />
|
|
|
+ <TextBlock
|
|
|
+ Width="168"
|
|
|
+ HorizontalAlignment="Center"
|
|
|
+ FontFamily="Segoe UI"
|
|
|
+ FontSize="12"
|
|
|
+ Foreground="#94989C"
|
|
|
+ Text="Please right-click on the selected page and select Add Outline, or click the Add button on the upper right to create a outline."
|
|
|
+ TextWrapping="Wrap" />
|
|
|
</StackPanel>
|
|
|
- <TreeView x:Name="OutlineView" Grid.Row="1" ItemsSource="{Binding Outlinelist}"
|
|
|
- Visibility="{Binding ElementName=NoOutlineStackPanel,Path=Visibility,Converter={StaticResource UnVisivleConvert}}"
|
|
|
- BorderThickness="0" AllowDrop="True"
|
|
|
- VirtualizingPanel.ScrollUnit="Pixel"
|
|
|
+ <TreeView
|
|
|
+ x:Name="OutlineView"
|
|
|
+ Grid.Row="1"
|
|
|
+ AllowDrop="True"
|
|
|
+ BorderThickness="0"
|
|
|
Drop="OutlineView_Drop"
|
|
|
- PreviewMouseMove="OutlineView_PreviewMouseMove"
|
|
|
- PreviewMouseLeftButtonUp="OutlineView_PreviewMouseLeftButtonUp"
|
|
|
+ ItemsSource="{Binding Outlinelist}"
|
|
|
PreviewMouseDoubleClick="OutlineView_PreviewMouseDoubleClick"
|
|
|
- ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
|
|
+ PreviewMouseLeftButtonUp="OutlineView_PreviewMouseLeftButtonUp"
|
|
|
+ PreviewMouseMove="OutlineView_PreviewMouseMove"
|
|
|
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
|
+ VirtualizingPanel.ScrollUnit="Pixel"
|
|
|
+ Visibility="{Binding ElementName=NoOutlineStackPanel, Path=Visibility, Converter={StaticResource UnVisivleConvert}}">
|
|
|
<TreeView.ItemTemplate>
|
|
|
- <HierarchicalDataTemplate DataType="{x:Type model:OutlineNode}" ItemsSource="{Binding Path=Chlidlist}">
|
|
|
+ <HierarchicalDataTemplate DataType="{x:Type model:OutlineNode}" ItemsSource="{Binding Path=Chlidlist}">
|
|
|
<Grid>
|
|
|
<Grid.ContextMenu>
|
|
|
<ContextMenu>
|
|
|
- <MenuItem x:Name="AddMenu" Click="AddMenu_Click" Header="添加条目"/>
|
|
|
- <MenuItem x:Name="AddChlidMenu" Click="AddChlidMenu_Click" Header="添加子条目"/>
|
|
|
- <MenuItem x:Name="AddParentMenu" Click="AddParentMenu_Click" Header="添加上一级条目" IsEnabled="{Binding CanAddParent}"/>
|
|
|
+ <MenuItem
|
|
|
+ x:Name="AddMenu"
|
|
|
+ Click="AddMenu_Click"
|
|
|
+ Header="添加条目" />
|
|
|
+ <MenuItem
|
|
|
+ x:Name="AddChlidMenu"
|
|
|
+ Click="AddChlidMenu_Click"
|
|
|
+ Header="添加子条目" />
|
|
|
+ <MenuItem
|
|
|
+ x:Name="AddParentMenu"
|
|
|
+ Click="AddParentMenu_Click"
|
|
|
+ Header="添加上一级条目"
|
|
|
+ IsEnabled="{Binding CanAddParent}" />
|
|
|
|
|
|
- <MenuItem x:Name="DeleteMenu" Click="DeleteMenu_Click" Header="删除"/>
|
|
|
+ <MenuItem
|
|
|
+ x:Name="DeleteMenu"
|
|
|
+ Click="DeleteMenu_Click"
|
|
|
+ Header="删除" />
|
|
|
|
|
|
- <MenuItem x:Name="RenameMenu" Click="RenameMenu_Click" Header="重命名"/>
|
|
|
- <MenuItem x:Name="ChangeDestinationMenu" Click="ChangeDestinationMenu_Click" Header="更改目标位置"/>
|
|
|
+ <MenuItem
|
|
|
+ x:Name="RenameMenu"
|
|
|
+ Click="RenameMenu_Click"
|
|
|
+ Header="重命名" />
|
|
|
+ <MenuItem
|
|
|
+ x:Name="ChangeDestinationMenu"
|
|
|
+ Click="ChangeDestinationMenu_Click"
|
|
|
+ Header="更改目标位置" />
|
|
|
|
|
|
- <MenuItem x:Name="UpgradeMenu" Click="UpgradeMenu_Click" Header="升级" IsEnabled="{Binding CanUp}"/>
|
|
|
- <MenuItem x:Name="DowngradeMenu" Click="DowngradeMenu_Click" Header="降级" IsEnabled="{Binding CanDown}"/>
|
|
|
+ <MenuItem
|
|
|
+ x:Name="UpgradeMenu"
|
|
|
+ Click="UpgradeMenu_Click"
|
|
|
+ Header="升级"
|
|
|
+ IsEnabled="{Binding CanUp}" />
|
|
|
+ <MenuItem
|
|
|
+ x:Name="DowngradeMenu"
|
|
|
+ Click="DowngradeMenu_Click"
|
|
|
+ Header="降级"
|
|
|
+ IsEnabled="{Binding CanDown}" />
|
|
|
</ContextMenu>
|
|
|
</Grid.ContextMenu>
|
|
|
- <Grid x:Name="ContentPanel" >
|
|
|
+ <Grid x:Name="ContentPanel">
|
|
|
<Grid.ToolTip>
|
|
|
- <!--圆角 https://wpf.2000things.com/2012/05/11/556-clipping-to-a-border-using-an-opacity-mask -->
|
|
|
- <ToolTip Width="320" Height="120" Opened="ToolTip_Opened" Closed="ToolTip_Closed" Style="{StaticResource ErrorRoundedTooltip}">
|
|
|
- <customcontrol:CustomImageControl Width="320" Height="120" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
|
|
|
+ <!-- 圆角 https://wpf.2000things.com/2012/05/11/556-clipping-to-a-border-using-an-opacity-mask -->
|
|
|
+ <ToolTip
|
|
|
+ Width="320"
|
|
|
+ Height="120"
|
|
|
+ Closed="ToolTip_Closed"
|
|
|
+ Opened="ToolTip_Opened"
|
|
|
+ Style="{StaticResource ErrorRoundedTooltip}">
|
|
|
+ <customcontrol:CustomImageControl
|
|
|
+ Width="320"
|
|
|
+ Height="120"
|
|
|
+ HorizontalAlignment="Stretch"
|
|
|
+ VerticalAlignment="Stretch" />
|
|
|
</ToolTip>
|
|
|
</Grid.ToolTip>
|
|
|
<Grid.ColumnDefinitions>
|
|
|
<ColumnDefinition />
|
|
|
<ColumnDefinition Width="auto" />
|
|
|
</Grid.ColumnDefinitions>
|
|
|
- <TextBlock x:Name="Content" Text="{Binding Outline.Title}" Visibility="{Binding IsReName,Mode=TwoWay}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/>
|
|
|
- <TextBlock x:Name="PageIndex" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding PageIndex}"/>
|
|
|
+ <TextBlock
|
|
|
+ x:Name="Content"
|
|
|
+ VerticalAlignment="Center"
|
|
|
+ Text="{Binding Outline.Title}"
|
|
|
+ TextTrimming="CharacterEllipsis"
|
|
|
+ Visibility="{Binding IsReName, Mode=TwoWay}" />
|
|
|
+ <TextBlock
|
|
|
+ x:Name="PageIndex"
|
|
|
+ Grid.Column="1"
|
|
|
+ HorizontalAlignment="Right"
|
|
|
+ VerticalAlignment="Center"
|
|
|
+ Text="{Binding PageIndex}" />
|
|
|
</Grid>
|
|
|
|
|
|
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Visibility="{Binding IsInsertNextLayer, Converter={StaticResource BoolToVisible}}" >
|
|
|
- <Ellipse Margin="0,0,0,0" Width="8" Height="8" Fill="White" Stroke="#FF0078D7" StrokeThickness="1.5" VerticalAlignment="Bottom"/>
|
|
|
- <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"/>
|
|
|
+ <StackPanel
|
|
|
+ HorizontalAlignment="Stretch"
|
|
|
+ Orientation="Horizontal"
|
|
|
+ Visibility="{Binding IsInsertNextLayer, Converter={StaticResource BoolToVisible}}">
|
|
|
+ <Ellipse
|
|
|
+ Width="8"
|
|
|
+ Height="8"
|
|
|
+ Margin="0,0,0,0"
|
|
|
+ VerticalAlignment="Bottom"
|
|
|
+ Fill="White"
|
|
|
+ Stroke="#FF0078D7"
|
|
|
+ StrokeThickness="1.5" />
|
|
|
+ <Line
|
|
|
+ Margin="-1,0,0,2"
|
|
|
+ HorizontalAlignment="Stretch"
|
|
|
+ VerticalAlignment="Bottom"
|
|
|
+ Stroke="#FF0078D7"
|
|
|
+ StrokeDashArray="2"
|
|
|
+ StrokeThickness="1.5"
|
|
|
+ X1="0"
|
|
|
+ X2="{Binding ElementName=ContentPanel, Path=ActualWidth}" />
|
|
|
</StackPanel>
|
|
|
- <Grid x:Name="RenameGrid"
|
|
|
- LostFocus="RenameGrid_LostFocus"
|
|
|
- Visibility="{Binding ElementName=Content,Path=Visibility,Mode=TwoWay,Converter={StaticResource UnVisivleConvert}}">
|
|
|
- <TextBox x:Name="ReName" HorizontalAlignment="Left" VerticalAlignment="Center"
|
|
|
- Style="{StaticResource TextBoxStyleRadius}"
|
|
|
- IsVisibleChanged="ReName_IsVisibleChanged"/>
|
|
|
+ <Grid
|
|
|
+ x:Name="RenameGrid"
|
|
|
+ LostFocus="RenameGrid_LostFocus"
|
|
|
+ Visibility="{Binding ElementName=Content, Path=Visibility, Mode=TwoWay, Converter={StaticResource UnVisivleConvert}}">
|
|
|
+ <TextBox
|
|
|
+ x:Name="ReName"
|
|
|
+ HorizontalAlignment="Left"
|
|
|
+ VerticalAlignment="Center"
|
|
|
+ IsVisibleChanged="ReName_IsVisibleChanged"
|
|
|
+ Style="{StaticResource TextBoxStyleRadius}" />
|
|
|
</Grid>
|
|
|
</Grid>
|
|
|
</HierarchicalDataTemplate>
|
|
|
</TreeView.ItemTemplate>
|
|
|
<TreeView.ItemContainerStyle>
|
|
|
<Style BasedOn="{StaticResource OutLineItemStyle}" TargetType="TreeViewItem">
|
|
|
- <EventSetter Event="PreviewMouseLeftButtonUp" Handler="TreeViewItem_PreviewMouseLeftButtonUp"/>
|
|
|
- <EventSetter Event="PreviewMouseLeftButtonDown" Handler="TreeViewItem_PreviewMouseLeftButtonDown"/>
|
|
|
+ <EventSetter Event="PreviewMouseLeftButtonUp" Handler="TreeViewItem_PreviewMouseLeftButtonUp" />
|
|
|
+ <EventSetter Event="PreviewMouseLeftButtonDown" Handler="TreeViewItem_PreviewMouseLeftButtonDown" />
|
|
|
</Style>
|
|
|
</TreeView.ItemContainerStyle>
|
|
|
</TreeView>
|
|
|
</Grid>
|
|
|
</Grid>
|
|
|
-</UserControl>
|
|
|
+</UserControl>
|