123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <Window x:Class="ComPDFKitDemo.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:ComPDFKitDemo"
- xmlns:toolbars="clr-namespace:ComPDFKitDemo.ToolBars"
- xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
- mc:Ignorable="d"
- Title="ComPDFKit.Demo" Height="600" Width="1024" WindowStartupLocation="CenterScreen" UseLayoutRounding="True">
- <Window.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="Resources/StyleResource.xaml"/>
- </ResourceDictionary.MergedDictionaries>
- </ResourceDictionary>
- </Window.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="auto"></RowDefinition>
- <RowDefinition Height="auto"></RowDefinition>
- <RowDefinition Height="*"></RowDefinition>
- <RowDefinition Height="auto"></RowDefinition>
- </Grid.RowDefinitions>
- <ToolBarTray Grid.Row="0" Grid.ColumnSpan="2">
- <ToolBar Name="toolbar_header0" >
- <Button Click="btnCollapsed_Clicked" Name="btn_collapse" IsEnabled="False">
- <Image Source="Resources\section_expanded.png" Height="16"/>
- <ToolTipService.ToolTip>
- <ToolTip Placement="Bottom">
- <TextBlock Text="Hide Navigation Sidebar"/>
- </ToolTip>
- </ToolTipService.ToolTip>
- </Button>
- <Button Click="btnExpand_Clicked" Name="btn_expand" IsEnabled="True">
- <Image Source="Resources\section_collapsed.png" Height="16"/>
- <ToolTipService.ToolTip>
- <ToolTip Placement="Bottom">
- <TextBlock Text="Show Navigation Sidebar"/>
- </ToolTip>
- </ToolTipService.ToolTip>
- </Button>
- </ToolBar>
- <ToolBar Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Name="toolbar_header1" >
- <Button Click="btnOpen_Clicked">
- <Image Source="Resources\docOpen.png" Height="32"/>
- <ToolTipService.ToolTip>
- <ToolTip Placement="Bottom">
- <TextBlock Text="Open"/>
- </ToolTip>
- </ToolTipService.ToolTip>
- </Button>
- <Button Name="btn_save" Click="btnSave_Clicked" IsEnabled="True">
- <Image Source="Resources\saveas.png" Height="32"/>
- <ToolTipService.ToolTip>
- <ToolTip Placement="Bottom">
- <TextBlock Text="Save"/>
- </ToolTip>
- </ToolTipService.ToolTip>
- </Button>
- </ToolBar>
- <ToolBar Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Name="toolbar_header2">
- <ToggleButton Click="PanTool_Clicked" Name="PanTool">
- <Image Source="Resources\hand.png" Height="32"/>
- <ToolTipService.ToolTip>
- <ToolTip Placement="Bottom">
- <TextBlock Text="Pan Tool"/>
- </ToolTip>
- </ToolTipService.ToolTip>
- </ToggleButton>
- <ToggleButton Click="TextSelectTool_Clicked" Name="TextSelectTool">
- <Image Source="Resources\texttool.gif" Height="32"/>
- <ToolTipService.ToolTip>
- <ToolTip Placement="Bottom">
- <TextBlock Text="Select Text"/>
- </ToolTip>
- </ToolTipService.ToolTip>
- </ToggleButton>
- <ToggleButton Click="FormEditTool_Clicked" Name="FormEditTool">
- <Image Source="Resources\FormEdit.png" Height="32"/>
- <ToolTipService.ToolTip>
- <ToolTip Placement="Bottom">
- <TextBlock Text="Form Edit"/>
- </ToolTip>
- </ToolTipService.ToolTip>
- </ToggleButton>
- <ToggleButton Click="TextEditTool_Clicked" Name="TextEditTool" Height="40" Width="40">
- <Image Source="Resources\annot_edit.png" Height="20"/>
- <ToolTipService.ToolTip>
- <ToolTip Placement="Bottom">
- <TextBlock Text="Text Edit"/>
- </ToolTip>
- </ToolTipService.ToolTip>
- </ToggleButton>
- <ToggleButton Name="SelectTool" Visibility="Collapsed" Click="AnnotDemo_Click" Tag="SelectTool" ToolTip="Select Annots">
- <ToggleButton.Content>
- <Rectangle Width="25" Height="25" StrokeThickness="2" Stroke="Red" StrokeDashArray="2,2"></Rectangle>
- </ToggleButton.Content>
- </ToggleButton>
- <ToggleButton Name="SnapTool" Visibility="Collapsed" Click="AnnotDemo_Click" Tag="SnapTool" Margin="10,0,0,0" ToolTip="Snap">
- <ToggleButton.Content>
- <Rectangle Width="25" Height="25" StrokeThickness="2" Stroke="Blue" StrokeDashArray="2,2"></Rectangle>
- </ToggleButton.Content>
- </ToggleButton>
- <ToggleButton Name="SnapEditTool" Visibility="Collapsed" Click="AnnotDemo_Click" Tag="SnapEditTool" Margin="10,0,0,0" ToolTip="SnapEdit">
- <ToggleButton.Content>
- <Rectangle Width="25" Height="25" StrokeThickness="2" Stroke="Pink" StrokeDashArray="2,2"></Rectangle>
- </ToggleButton.Content>
- </ToggleButton>
- <ToggleButton Name="OtherTools" Tag="Other Tools" ToolTip="Other Tools" Click="OtherTools_Click">
- <ToggleButton.Content>
- <Image Source="Resources/menu.png" Width="30" Height="30"></Image>
- </ToggleButton.Content>
- </ToggleButton>
- </ToolBar>
- <toolbars:PdfToolBar>
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
- <Button Padding="15,5,15,5" Margin="5,0,0,0" Click="Redo_Click" Tag="Redo" Content="Redo" IsEnabled="{Binding CanRedo,Mode=OneWay}"/>
- <Button Padding="15,5,15,5" Margin="5,0,0,0" Click="Undo_Click" Tag="Undo" Content="Undo" IsEnabled="{Binding CanUndo,Mode=OneWay}"/>
- </StackPanel>
- </toolbars:PdfToolBar>
- <toolbars:PdfToolBar>
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
- <Button x:Name="EnterPageEdit" Padding="5" Margin="5" Click="EnterPageEdit_Click" >Enter Page Edit</Button>
- <Button x:Name="ExitPageEdit" Padding="5" Margin="5" Click="ExitPageEdit_Click">Exit Page Edit</Button>
- </StackPanel>
- </toolbars:PdfToolBar>
- </ToolBarTray>
- <Grid Grid.Row="1">
- <WrapPanel Orientation="Horizontal" HorizontalAlignment="Center" Name="AnnotTools" Visibility="Collapsed">
- <ToggleButton Padding="15,5,15,5" Click="AnnotDemo_Click" Tag="Square" Margin="5,5,5,0">
- <ToggleButton.Content>
- <Rectangle Width="20" Height="20" StrokeThickness="2" Stroke="Red"></Rectangle>
- </ToggleButton.Content>
- </ToggleButton>
- <ToggleButton Padding="15,5,15,5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Circle">
- <ToggleButton.Content>
- <Ellipse Width="20" Height="20" StrokeThickness="2" Stroke="Red"></Ellipse>
- </ToggleButton.Content>
- </ToggleButton>
- <ToggleButton Padding="15,5,15,5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Line">
- <ToggleButton.Content>
- <Line Stroke="Red" StrokeThickness="2" Width="20" Height="20" X1="0" Y1="9" X2="20" Y2="9"></Line>
- </ToggleButton.Content>
- </ToggleButton>
- <ToggleButton Padding="15,5,15,5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="LineArrow">
- <ToggleButton.Content>
- <Path Fill="Red" Stroke="Red" Width="20" Height="20">
- <Path.Data>
- <PathGeometry>
- <PathGeometry.Figures>
- <PathFigureCollection>
- <PathFigure StartPoint="0,9" >
- <LineSegment Point="20,9"></LineSegment>
- </PathFigure>
- <PathFigure StartPoint="20,9">
- <LineSegment Point="15,5"></LineSegment>
- </PathFigure>
- <PathFigure StartPoint="20,9">
- <LineSegment Point="15,13"></LineSegment>
- </PathFigure>
- </PathFigureCollection>
- </PathGeometry.Figures>
- </PathGeometry>
- </Path.Data>
- </Path>
- </ToggleButton.Content>
- </ToggleButton>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Ink" Content="Ink"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Erase" Content="Erase"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="FreeText" Content="FreeText"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Highlight" Content="Highlight"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Underline" Content="Underline"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Strikeout" Content="Strikeout"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Squiggly" Content="Squiggly"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="StickyNote" Content="StickyNote"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Picture" Content="Picture"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Stamp" Content="Stamp"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Sign" Content="Sign"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Link" Content="Link"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Tag="Audio" Content="Audio"/>
-
- </WrapPanel>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Name="FormTools" Visibility="Collapsed">
- <ToggleButton Name="FormTextBox" Padding="5" Margin="5,0,5,0" Click="FormTools_Click" Tag="TextBox">TextBox</ToggleButton>
- <ToggleButton Name="FormCheckBox" Padding="5" Margin="5,0,5,0" Click="FormTools_Click" Tag="CheckBox">CheckBox</ToggleButton>
- <ToggleButton Name="FormRadio" Padding="5" Margin="5,0,5,0" Click="FormTools_Click" Tag="RadioBtn">RadioButton</ToggleButton>
- <ToggleButton Name="FormDropDown" Padding="5" Margin="5,0,5,0" Click="FormTools_Click" Tag="DropDown">ComboBox</ToggleButton>
- <ToggleButton Name="FormList" Padding="10,5,10,5" Margin="5,0,5,0" Click="FormTools_Click" Tag="List">ListBox</ToggleButton>
- <ToggleButton Name="FormBtn" Padding="5" Margin="5,0,5,0" Click="FormTools_Click" Tag="PushBtn">PushButton</ToggleButton>
- <ToggleButton Name="FormSign" Padding="5" Margin="5,0,5,0" Click="FormTools_Click" Tag="Sign">Sign</ToggleButton>
- </StackPanel>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Name="OtherToolsPanel" Visibility="Collapsed">
- <ToggleButton Name="FormHighlightBtn" Padding="5" Margin="5,5,5,0" Click="FormHighlightBtn_Click">Highlight Form</ToggleButton>
- <ToggleButton Name="PageOffset" Padding="5" Margin="5,5,5,0" IsChecked="True" Click="PageOffset_ClickEvent">Page Breaks</ToggleButton>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="CropButton_Click" Tag="Clip" Content="Crop Page"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="AutoCrop_Click" Tag="AutoClip" Content="Auto Crop"/>
- <ToggleButton Padding="5" Margin="5,5,0,0" Click="ShowLink_Click" Content="ShowLink" />
- <ToggleButton Name="RedactionBtn" Padding="5" Margin="5,5,0,0" Click="AnnotDemo_Click" Content="Mark for Redaction" Tag="Redaction"></ToggleButton>
- <ToggleButton x:Name="Encryption" Padding="5" Margin="5,5,0,0" Content="Encryption" Click="Encryption_Click"/>
- <Popup Name="EncryptionPopup" StaysOpen="False" PlacementTarget="{Binding ElementName=Encryption}" AllowsTransparency="True">
- <Grid Height="auto" Width="auto" HorizontalAlignment="Left">
- <Border BorderThickness="0" CornerRadius="3" Background="White" Margin="3">
- <Border.Effect>
- <DropShadowEffect ShadowDepth="0" Color="#FFB6B6B6"/>
- </Border.Effect>
- <StackPanel Margin="0">
- <MenuItem Header="SetPassword" Click="SetPassword_Click"></MenuItem>
- <MenuItem Header="RemovePassword" Click="RemovePassword_Click"></MenuItem>
-
- </StackPanel>
- </Border>
- </Grid>
- </Popup>
- </StackPanel>
- </Grid>
- <Grid Grid.Row="2" Name="PDFGrid" UseLayoutRounding="True">
- <dragablz:TabablzControl Name="PDFTab" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" BorderBrush="Silver"
- UseLayoutRounding="True" SelectionChanged="PDFTab_SelectionChanged" ClosingItemCallback="btnClose_Clicked">
- <dragablz:TabablzControl.InterTabController>
- <dragablz:InterTabController />
- </dragablz:TabablzControl.InterTabController>
- <dragablz:TabablzControl.ItemContainerStyle>
- <Style TargetType="dragablz:DragablzItem">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="dragablz:DragablzItem">
- <Grid x:Name="templateRoot">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="auto"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <Border x:Name="Title" Background="LightSkyBlue" BorderBrush="Silver" BorderThickness="1" CornerRadius="5,5,0,0">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="auto"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock Name="TextBlock" Foreground="Black">
- <ContentPresenter x:Name="contentPresenter" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="{TemplateBinding ContentControl.Content}" Margin="6,2,6,2" />
- </TextBlock>
- <Thumb HorizontalAlignment="Stretch" VerticalContentAlignment="Stretch" x:Name="PART_Thumb" Background="Transparent">
- <Thumb.Template>
- <ControlTemplate>
- <Grid Background="Transparent"/>
- </ControlTemplate>
- </Thumb.Template>
- </Thumb>
- <Button Grid.Column="1" Command="{x:Static dragablz:TabablzControl.CloseItemCommand}"
- CommandParameter="{Binding RelativeSource={RelativeSource TemplatedParent}}">
- <Button.Template>
- <ControlTemplate>
- <Grid>
- <Ellipse Width="15" Height="15" Fill="{TemplateBinding Background}"/>
- <Path x:Name="Path" Data="M0.5,71 L70,0.5 M0.5,1 L70,70.5" Width="6" Height="6" Stretch="Uniform" Stroke="{TemplateBinding Foreground}"
- StrokeThickness="1.5" StrokeStartLineCap="Square" StrokeEndLineCap="Square" SnapsToDevicePixels="True" />
- </Grid>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </Grid>
- </Border>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsSelected" Value="True">
- <Setter TargetName="Title" Property="Background" Value="LightGray"/>
- <Setter TargetName="Title" Property="BorderThickness" Value="1,1,1,0"/>
- <Setter TargetName="TextBlock" Property="FontWeight" Value="Bold"/>
- </Trigger>
- <Trigger Property="IsSelected" Value="False">
- <Setter TargetName="Title" Property="Background" Value="LightSkyBlue"/>
- </Trigger>
- <Trigger Property="dragablz:TabablzControl.IsWrappingTabItem" Value="True">
- <Setter TargetName="contentPresenter" Property="Content" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext.Header}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </dragablz:TabablzControl.ItemContainerStyle>
- </dragablz:TabablzControl>
- </Grid>
- <Grid Grid.Row="3" Background="#EEF5FD">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="1*"/>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="1*" />
- </Grid.ColumnDefinitions>
- <ToolBarTray x:Name="ToolbarBottom" Grid.Column="1" IsEnabled="False">
- <toolbars:PdfToolBarViewMode x:Name="ViewModelTool"></toolbars:PdfToolBarViewMode>
- <toolbars:PdfToolBarPages x:Name="PagesTool"></toolbars:PdfToolBarPages>
- <toolbars:PdfToolBarSizes x:Name="FitPageTool"></toolbars:PdfToolBarSizes>
- <toolbars:PdfToolBarZoom x:Name="ZoomTool"></toolbars:PdfToolBarZoom>
- </ToolBarTray>
- </Grid>
- </Grid>
- </Window>
|