123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- <UserControl
- x:Class="PDF_Office.Views.PageEdit.PageEditContent"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:convert="clr-namespace:PDF_Office.DataConvert"
- xmlns:cus="clr-namespace:PDF_Office.CustomControl"
- xmlns:cussys="clr-namespace:PDF_Office.CustomControl.SystemControl"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
- xmlns:local="clr-namespace:PDF_Office.Views.PageEdit"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:pageedit="clr-namespace:PDF_Office.Model.PageEdit"
- xmlns:pageedit1="clr-namespace:PDF_Office.ViewModels.PageEdit"
- xmlns:prism="http://prismlibrary.com/"
- xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
- Name="PageEdit"
- d:DataContext="{d:DesignInstance Type=pageedit1:PageEditContentViewModel}"
- d:DesignHeight="450"
- d:DesignWidth="800"
- prism:ViewModelLocator.AutoWireViewModel="True"
- IsVisibleChanged="PageEdit_IsVisibleChanged"
- mc:Ignorable="d">
- <UserControl.Resources>
- <ResourceDictionary>
- <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
- <DataTemplate x:Key="PageEditListBoxItemTemplate" DataType="{x:Type pageedit:PageEditItem}">
- <StackPanel>
- <Border
- Name="BdBorder"
- VerticalAlignment="Top"
- BorderBrush="Transparent"
- BorderThickness="2"
- CornerRadius="0">
- <Grid
- Width="{Binding ItemSize.Width}"
- Height="{Binding ItemSize.Height}"
- Margin="1"
- Background="Gray">
- <Image Source="{Binding Image}" Stretch="Uniform" />
- <Border
- Width="10"
- Height="10"
- Margin="0,10,10,0"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Background="Yellow"
- Visibility="{Binding HaveBookMark, Converter={StaticResource BoolToVisibleConvert}}" />
- </Grid>
- </Border>
- <Border
- Name="BdPageNum"
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Bottom"
- Background="Transparent">
- <StackPanel
- Name="StkpnlButtom"
- Width="auto"
- MinWidth="50"
- HorizontalAlignment="Center"
- Background="Transparent">
- <TextBlock
- Width="auto"
- Height="22"
- Margin="0,4"
- HorizontalAlignment="Center"
- FontSize="14"
- Text="{Binding PageNumber}" />
- <TextBlock
- Width="auto"
- Height="22"
- HorizontalAlignment="Center"
- FontSize="14"
- Text="{Binding PageSize}"
- Visibility="{Binding ShowPageSize, Converter={StaticResource BoolToVisibleConvert}}" />
- </StackPanel>
- </Border>
- </StackPanel>
- <DataTemplate.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
- <Setter TargetName="BdBorder" Property="BorderBrush" Value="Blue" />
- <Setter TargetName="BdBorder" Property="CornerRadius" Value="4" />
- <Setter TargetName="BdPageNum" Property="Background" Value="Blue" />
- <Setter TargetName="BdPageNum" Property="CornerRadius" Value="4" />
- </DataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsMouseOver}" Value="True" />
- <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="False" />
- </MultiDataTrigger.Conditions>
- <MultiDataTrigger.Setters>
- <Setter TargetName="BdBorder" Property="BorderBrush" Value="Blue" />
- <Setter TargetName="BdBorder" Property="CornerRadius" Value="4" />
- </MultiDataTrigger.Setters>
- </MultiDataTrigger>
- </DataTemplate.Triggers>
- </DataTemplate>
- </ResourceDictionary>
- </UserControl.Resources>
- <Border BorderBrush="#F2F2F2" BorderThickness="0,1,0,0">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="40" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Grid Background="#FFFFFF">
- <StackPanel
- Name="StkpnlCenter"
- HorizontalAlignment="Center"
- Orientation="Horizontal">
- <Grid>
- <ComboBox
- Width="117"
- Height="23"
- ItemsSource="{Binding PageRangeItems}"
- SelectedIndex="{Binding ComboxSelectIndex, Mode=TwoWay}" />
- <TextBlock
- Width="90"
- Height="20"
- Margin="1,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Background="White"
- Text="{Binding TbPageRange}"
- Visibility="{Binding TbPageRangeVisibility}" />
- <TextBox
- Width="90"
- Height="20"
- Margin="1,0"
- HorizontalAlignment="Left"
- Background="White"
- InputMethod.IsInputMethodEnabled="False"
- IsVisibleChanged="TextBox_IsVisibleChanged"
- Visibility="{Binding TxtPageInputVisibility}">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="PreviewKeyDown">
- <i:InvokeCommandAction Command="{Binding PreviewKeyDown}" PassEventArgsToCommand="True" />
- </i:EventTrigger>
- <i:EventTrigger EventName="KeyDown">
- <i:InvokeCommandAction Command="{Binding KeyDown}" PassEventArgsToCommand="True" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </TextBox>
- </Grid>
- <Button
- Width="20"
- Height="20"
- Margin="5"
- Command="{Binding LeftRotateCommand}">
- <Path Data="M8,0.5 C11.5898509,0.5 14.5,3.43884135 14.5,7.06408587 C14.5,10.6893304 11.5898509,13.6281717 8,13.6281717 C7.71394437,13.6281717 7.4302177,13.6094794 7.15010992,13.5725129 L8.35355339,14.7859216 L7.64644661,15.5 L5.29289322,13.1232421 L7.64644661,10.7464841 L8.35355339,11.4605625 L7.25820051,12.5682882 C7.50239929,12.6015049 7.7500379,12.6183124 8,12.6183124 C11.0375661,12.6183124 13.5,10.1316005 13.5,7.06408587 C13.5,3.99657128 11.0375661,1.50985937 8,1.50985937 C5.03652085,1.50985937 2.62046086,3.87674756 2.5043672,6.84069777 L2.5,7.06408587 L1.5,7.06408587 C1.5,3.43884135 4.41014913,0.5 8,0.5 Z M8,5.54929683 C8.82842712,5.54929683 9.5,6.22749098 9.5,7.06408587 C9.5,7.90068077 8.82842712,8.57887492 8,8.57887492 C7.17157288,8.57887492 6.5,7.90068077 6.5,7.06408587 C6.5,6.22749098 7.17157288,5.54929683 8,5.54929683 Z M8,6.55915619 C7.72385763,6.55915619 7.5,6.78522091 7.5,7.06408587 C7.5,7.34295084 7.72385763,7.56901556 8,7.56901556 C8.27614237,7.56901556 8.5,7.34295084 8.5,7.06408587 C8.5,6.78522091 8.27614237,6.55915619 8,6.55915619 Z" Fill="Black">
- <Path.RenderTransform>
- <TransformGroup>
- <TranslateTransform X="10.000000" Y="8.000000" />
- <ScaleTransform ScaleX="-1" ScaleY="1" />
- <TranslateTransform X="25.000000" Y="-8.000000" />
- </TransformGroup>
- </Path.RenderTransform>
- </Path>
- </Button>
- <Button
- Width="20"
- Height="20"
- Margin="5"
- Command="{Binding RightRotateCommand}">
- <Path Data="M8,0.5 C11.5898509,0.5 14.5,3.43884135 14.5,7.06408587 C14.5,10.6893304 11.5898509,13.6281717 8,13.6281717 C7.71394437,13.6281717 7.4302177,13.6094794 7.15010992,13.5725129 L8.35355339,14.7859216 L7.64644661,15.5 L5.29289322,13.1232421 L7.64644661,10.7464841 L8.35355339,11.4605625 L7.25820051,12.5682882 C7.50239929,12.6015049 7.7500379,12.6183124 8,12.6183124 C11.0375661,12.6183124 13.5,10.1316005 13.5,7.06408587 C13.5,3.99657128 11.0375661,1.50985937 8,1.50985937 C5.03652085,1.50985937 2.62046086,3.87674756 2.5043672,6.84069777 L2.5,7.06408587 L1.5,7.06408587 C1.5,3.43884135 4.41014913,0.5 8,0.5 Z M8,5.54929683 C8.82842712,5.54929683 9.5,6.22749098 9.5,7.06408587 C9.5,7.90068077 8.82842712,8.57887492 8,8.57887492 C7.17157288,8.57887492 6.5,7.90068077 6.5,7.06408587 C6.5,6.22749098 7.17157288,5.54929683 8,5.54929683 Z M8,6.55915619 C7.72385763,6.55915619 7.5,6.78522091 7.5,7.06408587 C7.5,7.34295084 7.72385763,7.56901556 8,7.56901556 C8.27614237,7.56901556 8.5,7.34295084 8.5,7.06408587 C8.5,6.78522091 8.27614237,6.55915619 8,6.55915619 Z" Fill="Black" />
- </Button>
- <Separator
- Width="1"
- Height="24"
- Margin="5,0"
- BorderBrush="#33000000"
- BorderThickness="5"
- Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
- <Button
- Height="20"
- Margin="5"
- Command="{Binding InsertCommand}"
- Content="插入" />
- <Button
- Height="20"
- Margin="5"
- Command="{Binding ExtractCommand}"
- Content="提取" />
- <Button
- Height="20"
- Margin="5"
- Command="{Binding ReplaceCommand}"
- Content="替换" />
- <Button
- Height="20"
- Margin="5"
- Command="{Binding SplitCommand}"
- Content="拆分" />
- <Button
- Height="20"
- Margin="5"
- Command="{Binding ReverseCommand}"
- Content="倒序" />
- <Separator
- Width="1"
- Height="24"
- Margin="5,0"
- BorderBrush="#33000000"
- BorderThickness="5"
- Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
- <Button
- Height="20"
- Margin="5"
- Command="{Binding DeleteCommand}"
- Content="删除" />
- </StackPanel>
- <StackPanel
- Name="StkpnlRight"
- HorizontalAlignment="Right"
- Orientation="Horizontal">
- <Button
- Width="25"
- Height="25"
- Margin="4"
- Command="{Binding ZoomInCommand}">
- <Path Data="M6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.12212 13 9.60545 12.4058 10.7442 11.4232L14.821 15.5L15.5 14.821L11.4232 10.7442C12.4058 9.60545 13 8.12212 13 6.5C13 2.91015 10.0899 0 6.5 0ZM6.5 1C9.53757 1 12 3.46243 12 6.5C12 9.53757 9.53757 12 6.5 12C3.46243 12 1 9.53757 1 6.5C1 3.46243 3.46243 1 6.5 1ZM10 6H7V3H6V6H3V7H6V10H7V7H10V6Z" Fill="Black" />
- </Button>
- <Button
- Width="25"
- Height="25"
- Margin="4"
- Command="{Binding ZoomOutCommand}">
- <Path Data="M0 6.5C0 2.91015 2.91015 0 6.5 0C10.0899 0 13 2.91015 13 6.5C13 8.12212 12.4058 9.60545 11.4232 10.7442L15.5 14.821L14.821 15.5L10.7442 11.4232C9.60545 12.4058 8.12212 13 6.5 13C2.91015 13 0 10.0899 0 6.5ZM12 6.5C12 3.46243 9.53757 1 6.5 1C3.46243 1 1 3.46243 1 6.5C1 9.53757 3.46243 12 6.5 12C9.53757 12 12 9.53757 12 6.5ZM10 6V7H3V6H10Z" Fill="Black" />
- </Button>
- </StackPanel>
- </Grid>
- <ListBox
- Name="ListPageEdit"
- Grid.Row="1"
- Padding="0"
- AllowDrop="True"
- ItemTemplate="{StaticResource PageEditListBoxItemTemplate}"
- ItemsSource="{Binding PageEditItems}"
- ScrollBar.Scroll="ListPageEdit_Scroll"
- ScrollViewer.ScrollChanged="ListPageEdit_ScrollChanged"
- SelectedIndex="{Binding ListSelectedIndex, Mode=TwoWay}"
- SelectionMode="Extended">
- <!-- 此处要用循环模式,否则滚动时容易误触发EndSscroll 从而频繁拿图导致卡顿 -->
- <ListBox.ItemContainerStyle>
- <Style TargetType="{x:Type ListBoxItem}">
- <Setter Property="Template" Value="{StaticResource ListBoxItemControlTemplate}" />
- <Setter Property="Margin" Value="0,10" />
- <Setter Property="Visibility" Value="{Binding Visible}" />
- <Setter Property="IsSelected" Value="{Binding Selected, Mode=TwoWay}" />
- </Style>
- </ListBox.ItemContainerStyle>
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <!-- item间距自适应 -->
- <wpftk:VirtualizingWrapPanel />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="SelectionChanged">
- <i:InvokeCommandAction Command="{Binding SelectionChangedCommand}" PassEventArgsToCommand="True" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </ListBox>
- <cus:ToastControl
- Grid.Row="1"
- Width="auto"
- Height="auto"
- Margin="0,0,0,200"
- VerticalAlignment="Bottom"
- Background="#89000000"
- BeginTime="0:0:0:3"
- CornerRadius="4"
- FontSize="14"
- Foreground="White"
- StringContent="Press Esc To Exit Full Mode"
- Visibility="{Binding ShowTip}"
- Duration="0:0:0:3" />
- <ProgressBar
- Grid.Row="1"
- Width="400"
- Height="50"
- IsIndeterminate="True"
- Visibility="{Binding IsLoading}" />
- </Grid>
- </Border>
- </UserControl>
|