123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- <UserControl
- x:Class="PDF_Master.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_Master.ViewModels.BOTA"
- xmlns:customcontrol="clr-namespace:PDF_Master.CustomControl"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:PDF_Master.Views.BOTA"
- xmlns:mainPageLoader="clr-namespace:PDF_Master.Strings.MainPage"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:model="clr-namespace:PDF_Master.Model.BOTA"
- d:DataContext="{d:DesignInstance Type=bota:OutLineControlViewModel}"
- d:DesignWidth="400"
- KeyDown="UserControl_KeyDown"
- mc:Ignorable="d">
- <UserControl.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="pack://application:,,,/PDF Master;component/Styles/OutLineItemStyle.xaml" />
- </ResourceDictionary.MergedDictionaries>
- <ContextMenu x:Key="OutLineItemMenu">
- <MenuItem
- x:Name="AddMenu"
- Click="AddMenu_Click"
- Header="{x:Static mainPageLoader:MainPage.Outline_Add}" />
- <MenuItem
- x:Name="AddChlidMenu"
- Click="AddChlidMenu_Click"
- Header="{x:Static mainPageLoader:MainPage.Outline_AddSub}" />
- <MenuItem
- x:Name="AddParentMenu"
- Click="AddParentMenu_Click"
- Header="{x:Static mainPageLoader:MainPage.Outline_AddLevel}"
- IsEnabled="{Binding CanAddParent}" />
- <MenuItem
- x:Name="DeleteMenu"
- Click="DeleteMenu_Click"
- Header="{x:Static mainPageLoader:MainPage.Outline_Delete}" />
- <MenuItem
- x:Name="RenameMenu"
- Click="RenameMenu_Click"
- Header="{x:Static mainPageLoader:MainPage.Outline_Rename}" />
- <MenuItem
- x:Name="ChangeDestinationMenu"
- Click="ChangeDestinationMenu_Click"
- Header="{x:Static mainPageLoader:MainPage.Outline_Change}" />
- <MenuItem
- x:Name="UpgradeMenu"
- Click="UpgradeMenu_Click"
- Header="{x:Static mainPageLoader:MainPage.Outline_Up}"
- IsEnabled="{Binding CanUp}" />
- <MenuItem
- x:Name="DowngradeMenu"
- Click="DowngradeMenu_Click"
- Header="{x:Static mainPageLoader:MainPage.Outline_Down}"
- IsEnabled="{Binding CanDown}" />
- </ContextMenu>
- <!-- 圆角 https://wpf.2000things.com/2012/05/11/556-clipping-to-a-border-using-an-opacity-mask -->
- <ToolTip
- x:Key="OutLineItemToolTip"
- Width="320"
- Height="120"
- Closed="ToolTip_Closed"
- Opened="ToolTip_Opened"
- Style="{StaticResource ErrorRoundedTooltip}">
- <customcontrol:CustomImageControl
- Width="320"
- Height="120"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch" />
- </ToolTip>
- </ResourceDictionary>
- </UserControl.Resources>
- <Grid Background="Transparent">
- <Grid.RowDefinitions>
- <RowDefinition Height="48" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="0,0,0,1">
- <Grid x:Name="Header">
- <TextBlock
- x:Name="TxtTitle"
- Margin="16,0,0,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- FontFamily="Segoe UI"
- FontSize="14"
- FontWeight="SemiBold"
- Text="{Binding T_Title}" />
- <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
- <customcontrol:PathButton
- x:Name="BtnAdd"
- Width="32"
- Height="32"
- HorizontalContentAlignment="Center"
- Click="BtnAdd_Click"
- CornerRadius="4"
- Icon="{StaticResource Ic_AddButtonPath}"
- IconFill="#616469"
- IconHeight="16"
- IconMouseOver="{StaticResource Ic_AddButtonPath}"
- IconMouseOverFill="#616469"
- IconPress="{StaticResource Ic_AddButtonPath}"
- IconPressFill="#616469"
- IconWidth="16"
- MouseDownBackground="{StaticResource color.item-state.sel.bg.lv3}"
- MouseDownBorderBrush="{StaticResource color.item-state.sel.border.lv3}"
- MouseOverBackground="{StaticResource color.item-state.hov.bg}" />
- <customcontrol:PathButton
- x:Name="BtnMore"
- Width="32"
- Height="32"
- HorizontalContentAlignment="Center"
- Click="BtnMore_Click"
- CornerRadius="4"
- Icon="{StaticResource Ic_MoreButtonPath}"
- IconFill="#616469"
- IconHeight="16"
- IconMouseOver="{StaticResource Ic_MoreButtonPath}"
- IconMouseOverFill="#616469"
- IconPress="{StaticResource Ic_MoreButtonPath}"
- IconPressFill="#616469"
- IconWidth="16"
- MouseDownBackground="{StaticResource color.item-state.sel.bg.lv3}"
- MouseDownBorderBrush="{StaticResource color.item-state.sel.border.lv3}"
- MouseOverBackground="{StaticResource color.item-state.hov.bg}">
- <customcontrol:PathButton.ContextMenu>
- <ContextMenu Name="MenuMore">
- <ContextMenu.ItemContainerStyle>
- <Style BasedOn="{StaticResource GlobalMenuItem}" TargetType="MenuItem">
- <Setter Property="Padding" Value="-25,7,-40,7" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- </Style>
- </ContextMenu.ItemContainerStyle>
- <MenuItem
- Name="MenuExpandAll"
- Command="{Binding ExpandAllCommand}"
- CommandParameter="{Binding Outlinelist}"
- Header="{Binding T_Expand}" />
- <MenuItem
- Name="MenuCollapseAll"
- Command="{Binding CollapseAllCommand}"
- CommandParameter="{Binding Outlinelist}"
- Header="{Binding T_Collapse}" />
- <MenuItem
- Name="MenuDeleteAll"
- Command="{Binding DeleteAllCommand}"
- Header="{Binding T_RemoveAll}" />
- </ContextMenu>
- </customcontrol:PathButton.ContextMenu>
- </customcontrol:PathButton>
- </StackPanel>
- </Grid>
- </Border>
- <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"
- DragLeave="Grid_DragLeave"
- DragOver="Grid_DragOver">
- <StackPanel
- x:Name="NoOutlineStackPanel"
- VerticalAlignment="Center"
- Visibility="{Binding Outlinelist.Count, Converter={StaticResource ListCountToVisible}}">
- <Image
- Width="128"
- Height="128"
- Source="pack://application:,,,/PDF Master;component/Resources/BOTA/no_outline.png" />
- <TextBlock
- Height="22"
- HorizontalAlignment="Center"
- FontFamily="Segoe UI"
- FontSize="14"
- Text="No Outlines" />
- <TextBlock
- Width="168"
- HorizontalAlignment="Center"
- FontFamily="Segoe UI"
- FontSize="12"
- Foreground="#94989C"
- Text="Please right-click on the selected text or click the 'Add' button on the upper right to create an outline."
- TextWrapping="Wrap" />
- </StackPanel>
- <TreeView
- x:Name="OutlineView"
- Grid.Row="1"
- AllowDrop="True"
- Background="Transparent"
- BorderThickness="0"
- Drop="OutlineView_Drop"
- ItemsSource="{Binding Outlinelist}"
- PreviewMouseDoubleClick="OutlineView_PreviewMouseDoubleClick"
- PreviewMouseDown="OutlineView_PreviewMouseDown"
- 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}">
- <Grid>
- <Grid x:Name="ContentPanel">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition Width="auto" />
- </Grid.ColumnDefinitions>
- <TextBlock
- x:Name="Content"
- VerticalAlignment="Center"
- Text="{Binding Outline.Title}"
- TextWrapping="Wrap"
- Visibility="{Binding IsReName, Mode=TwoWay}" />
- <TextBlock
- x:Name="PageIndex"
- Grid.Column="1"
- HorizontalAlignment="Right"
- VerticalAlignment="Center"
- Text="{Binding PageIndex}"
- Visibility="Collapsed" />
- </Grid>
- <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"
- IsVisibleChanged="ReName_IsVisibleChanged"
- KeyDown="ReName_KeyDown"
- Style="{StaticResource TextBoxStyleRadius}"
- TextWrapping="WrapWithOverflow" />
- </Grid>
- </Grid>
- </HierarchicalDataTemplate>
- </TreeView.ItemTemplate>
- <TreeView.ItemContainerStyle>
- <Style BasedOn="{StaticResource OutLineItemStyle}" TargetType="TreeViewItem">
- <Setter Property="ContextMenu" Value="{StaticResource OutLineItemMenu}" />
- <Setter Property="ToolTip" Value="{StaticResource OutLineItemToolTip}" />
- <EventSetter Event="PreviewMouseLeftButtonUp" Handler="TreeViewItem_PreviewMouseLeftButtonUp" />
- <EventSetter Event="PreviewMouseLeftButtonDown" Handler="TreeViewItem_PreviewMouseLeftButtonDown" />
- </Style>
- </TreeView.ItemContainerStyle>
- </TreeView>
- </Grid>
- </Grid>
- </UserControl>
|