123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376 |
- <Window x:Class="PDFViewer.MainWindow"
- x:Name="Window"
- 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:PDFViewer"
- mc:Ignorable="d"
- AllowDrop="True"
- Style="{DynamicResource WindowStyle}"
- BorderBrush="#0079cb"
- xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common;assembly=Compdfkit_Tools"
- xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl;assembly=Compdfkit_Tools"
- xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
- xmlns:sys="clr-namespace:System;assembly=mscorlib"
- BorderThickness="{Binding RelativeSource={RelativeSource Mode=Self},Path=WindowState,Converter={StaticResource WindowStateToThicknessConverter}}"
- Title="{Binding AppInfo}" Height="720" Width="1200" MinWidth="780">
- <Window.Resources>
- <cpdfcommon:HomePageHeightConverter x:Key="HomePageHeightConverter"></cpdfcommon:HomePageHeightConverter>
- <cpdfcommon:HeightToTopMarginConverter x:Key="HeightToTopMarginConverter"></cpdfcommon:HeightToTopMarginConverter>
- <cpdfcommon:BoolToVisibleConverter x:Key="BoolToVisibleConverter"></cpdfcommon:BoolToVisibleConverter>
- <cpdfcommon:BoolToColorConverter x:Key="BoolToColorConverter"></cpdfcommon:BoolToColorConverter>
- <Style x:Key="WindowStyle" TargetType="{x:Type Window}">
- <Setter Property="WindowChrome.WindowChrome">
- <Setter.Value>
- <WindowChrome
- CaptionHeight="32"
- CornerRadius="0"
- GlassFrameThickness="0"
- ResizeBorderThickness="5"
- UseAeroCaptionButtons="False" />
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Window}">
- <Border
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}">
- <AdornerDecorator>
- <ContentPresenter x:Name="win_content" />
- </AdornerDecorator>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <ControlTemplate x:Key="CloseFileButton" TargetType="{x:Type ButtonBase}">
- <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
- BorderBrush="{TemplateBinding Border.BorderBrush}"
- Background="{TemplateBinding Panel.Background}"
- Name="border"
- CornerRadius="15"
- SnapsToDevicePixels="True">
- <Path Name="content" VerticalAlignment="Center" HorizontalAlignment="Center" Fill="#777777">
- <Path.RenderTransform>
- <TransformGroup>
- <TranslateTransform X="8" Y="-8"/>
- <RotateTransform Angle="45"/>
- <TranslateTransform X="-4" Y="-5"/>
- </TransformGroup>
- </Path.RenderTransform>
- <Path.Data>
- M9.48528137,2.98528137 L9.48428137,8.48428137 L14.9852814,8.48528137 L14.9852814,9.48528137 L9.48428137,9.48428137 L9.48528137,14.9852814 L8.48528137,14.9852814
- L8.48428137,9.48428137 L2.98528137,9.48528137 L2.98528137,8.48528137 L8.48428137,8.48428137 L8.48528137,2.98528137 L9.48528137,2.98528137 Z
- </Path.Data>
- </Path>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="Button.IsDefaulted" Value="True">
- <Setter Property="Path.Fill" TargetName="content" Value="#777777" />
- </Trigger>
- <Trigger Property="UIElement.IsMouseOver" Value="True">
- <Setter Property="Path.Fill" TargetName="content" Value="#efefef" />
- <Setter Property="Background" TargetName="border" Value="#8f000000" />
- </Trigger>
- <Trigger Property="ButtonBase.IsPressed" Value="True">
- <Setter Property="Path.Fill" TargetName="content" Value="#000000" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <ControlTemplate x:Key="AddFileButton" TargetType="{x:Type ButtonBase}">
- <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
- BorderBrush="{TemplateBinding Border.BorderBrush}"
- Background="{TemplateBinding Panel.Background}"
- Name="border"
- CornerRadius="15"
- SnapsToDevicePixels="True">
- <Path Name="content" VerticalAlignment="Center" HorizontalAlignment="Center" Fill="#FFFFFF">
- <Path.RenderTransform>
- <TransformGroup>
- <TranslateTransform X="-1.5" Y="-1"/>
- </TransformGroup>
- </Path.RenderTransform>
- <Path.Data>
- M9.48528137,2.98528137 L9.48428137,8.48428137 L14.9852814,8.48528137 L14.9852814,9.48528137 L9.48428137,9.48428137 L9.48528137,14.9852814 L8.48528137,14.9852814
- L8.48428137,9.48428137 L2.98528137,9.48528137 L2.98528137,8.48528137 L8.48428137,8.48428137 L8.48528137,2.98528137 L9.48528137,2.98528137 Z
- </Path.Data>
- </Path>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="Button.IsDefaulted" Value="True">
- <Setter Property="Path.Fill" TargetName="content" Value="#666666" />
- </Trigger>
- <Trigger Property="UIElement.IsMouseOver" Value="True">
- <Setter Property="BorderBrush" TargetName="border" Value="#5affffff" />
- <Setter Property="BorderThickness" TargetName="border" Value="2" />
- </Trigger>
- <Trigger Property="ButtonBase.IsPressed" Value="True">
- <Setter Property="Background" TargetName="border" Value="#5affffff" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <Style x:Key="HomePageButtonStyle" TargetType="{x:Type cpdfcommon:HomePageButton}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type cpdfcommon:HomePageButton}">
- <Border x:Name="border"
- Background="Transparent"
- BorderThickness="0"
- SnapsToDevicePixels="True"
- Margin="0,3,3,3"
- CornerRadius="5">
- <ContentPresenter x:Name="contentPresenter"
- Margin="0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Focusable="False"
- RecognizesAccessKey="True" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="border" Property="Background" Value="#5Affffff" />
- </Trigger>
- <Trigger Property="IsToggled" Value="true">
- <Setter TargetName="border" Property="Background" Value="#ffffff" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="DragablzItemStyle" TargetType="{x:Type dragablz:DragablzItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="dragablz:DragablzItem">
- <Grid x:Name="templateRoot">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="auto" />
- </Grid.ColumnDefinitions>
- <Border x:Name="TitleBd" Width="184" Height="32" Margin="0,3,0,0" CornerRadius="5,5,0,0">
- <Grid Background="Transparent">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto" />
- <ColumnDefinition Width="auto" />
- <ColumnDefinition Width="*" MinWidth="10" />
- <ColumnDefinition Width="auto" />
- </Grid.ColumnDefinitions>
- <Border x:Name="InnerTitleBd" Grid.ColumnSpan="4" BorderBrush="#5Affffff" CornerRadius="3" BorderThickness="1,0,1,0" Margin="2,1,2,4"></Border>
- <TextBlock x:Name="TextTitle" Grid.Column="1" MaxWidth="140" Margin="8,4,0,4" FontWeight="DemiBold" FontFamily="Microsoft YaHei,Microsoft YaHei" Text="{Binding FileName}" TextTrimming="WordEllipsis" />
- <Thumb x:Name="PART_Thumb" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalContentAlignment="Stretch" Background="Transparent" FontFamily="Microsoft YaHei,Microsoft YaHei" ToolTip="{Binding FileName}">
- <Thumb.Template>
- <ControlTemplate>
- <Grid Background="Transparent" />
- </ControlTemplate>
- </Thumb.Template>
- </Thumb>
- <Button x:Name="CloseFileButton" Grid.Column="3" Width="18" Height="18" Margin="0,4,8,4" Background="Transparent" BorderThickness="0" Template="{StaticResource CloseFileButton}" Click="CloseFileButton_Click" ToolTip="Close file"></Button>
- </Grid>
- </Border>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsSelected" Value="True">
- <Setter TargetName="TitleBd" Property="Background" Value="#FFFFFF" />
- <Setter TargetName="TitleBd" Property="BorderThickness" Value="1,1,1,0" />
- <Setter TargetName="TitleBd" Property="Margin" Value="0,3,0,-1" />
- <Setter TargetName="TextTitle" Property="Foreground" Value="Black" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="TitleBd" Property="Background" Value="#FFFFFF" />
- <Setter TargetName="TitleBd" Property="BorderThickness" Value="1,1,1,0" />
- <Setter TargetName="TextTitle" Property="Foreground" Value="Black" />
- </Trigger>
- <Trigger Property="IsSelected" Value="False">
- <Setter TargetName="TitleBd" Property="Background" Value="TransParent" />
- <Setter TargetName="TitleBd" Property="BorderThickness" Value="1,1,1,0" />
- <Setter TargetName="TextTitle" Property="Foreground" Value="White" />
- </Trigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
- <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
- </MultiDataTrigger.Conditions>
- <Setter TargetName="InnerTitleBd" Property="Background" Value="#5Affffff" />
- <Setter TargetName="TextTitle" Property="Foreground" Value="White" />
- </MultiDataTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="TitleBarButtonStyle" TargetType="Button">
- <Setter Property="Foreground" Value="#FFFFFF" />
- <Setter Property="Padding" Value="0" />
- <Setter Property="Margin" Value="0" />
- <Setter Property="VerticalAlignment" Value="Top" />
- <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="Width" Value="36" />
- <Setter Property="Height" Value="30" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border x:Name="border"
- Background="Transparent"
- BorderThickness="0"
- SnapsToDevicePixels="True">
- <ContentPresenter x:Name="contentPresenter"
- Margin="0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Focusable="False"
- RecognizesAccessKey="True" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="border" Property="Background" Value="#1AE9E9E9" />
- </Trigger>
- <Trigger Property="IsPressed" Value="true">
- <Setter TargetName="border" Property="Background" Value="#1AEDEDED" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="TitleBarCloseButtonStyle" BasedOn="{StaticResource TitleBarButtonStyle}" TargetType="Button">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border x:Name="border"
- Background="Transparent"
- BorderThickness="0"
- SnapsToDevicePixels="True">
- <ContentPresenter x:Name="contentPresenter"
- Margin="0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Focusable="False"
- RecognizesAccessKey="True" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="border" Property="Background" Value="#C42B1C" />
- </Trigger>
- <Trigger Property="IsPressed" Value="true">
- <Setter TargetName="border" Property="Background" Value="#C84031" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Window.Resources>
- <Grid>
- <Grid Background="#273C62" Margin="0,-1,0,0">
- <dragablz:TabablzControl Name="TabControl" ItemContainerStyle="{StaticResource DragablzItemStyle}" WindowChrome.IsHitTestVisibleInChrome="True">
- <dragablz:TabablzControl.HeaderPrefixContent>
- <Grid Margin="10,0,0,0">
- <StackPanel Orientation="Horizontal">
- <cpdfcommon:HomePageButton Style="{StaticResource HomePageButtonStyle}" x:Name="HomePageButton" Width="170" IsToggled="False" Toggled="HomePageButton_Toggled" QueryLock="HomePageButton_QueryLock">
- <Grid>
- <StackPanel Orientation="Horizontal">
- <Viewbox Width="20" Height="20" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
- <Grid>
- <Path Data="M0 1.71429C0 0.767513 0.767512 0 1.71429 0H13.7143C14.6611 0 15.4286 0.767512 15.4286 1.71429V16.2857H1.71429C0.767512 16.2857 0 15.5182 0 14.5714V1.71429Z" Fill="#3863F1"/>
- <Path Data="M10.857 3.71387C7.3855 3.71387 4.57129 6.52808 4.57129 9.99958C4.57129 13.4711 7.3855 16.2853 10.857 16.2853H15.4284V3.71387H10.857ZM10.857 7.71384C9.59459 7.71384 8.57125 8.73719 8.57125 9.99955C8.57125 11.2619 9.5946 12.2853 10.857 12.2853H15.4284V7.71384H10.857Z" Fill="White"/>
- <Path Data="M18.2856 3.71387H15.4284L15.4284 7.71385H10.857C9.59465 7.71385 8.5713 8.7372 8.5713 9.99956C8.5713 11.2619 9.59465 12.2853 10.857 12.2853H15.4284L15.4284 16.2853L4.57129 16.2853V18.2853C4.57129 19.2321 5.3388 19.9996 6.28558 19.9996H18.2856C19.2324 19.9996 19.9999 19.2321 19.9999 18.2853V5.42815C19.9999 4.48138 19.2324 3.71387 18.2856 3.71387Z" Fill="#31BC98"/>
- </Grid>
- </Viewbox>
- <TextBlock Margin="10,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" FontFamily="Microsoft YaHei" FontSize="12" FontWeight="DemiBold" Text="{Binding AppInfo}">
- <TextBlock.Foreground>
- <Binding Path="IsToggled" ElementName="HomePageButton" Converter="{StaticResource BoolToColorConverter}"></Binding>
- </TextBlock.Foreground>
- </TextBlock>
- </StackPanel>
- </Grid>
- </cpdfcommon:HomePageButton>
- </StackPanel>
- </Grid>
- </dragablz:TabablzControl.HeaderPrefixContent>
- <dragablz:TabablzControl.InterTabController>
- <dragablz:InterTabController />
- </dragablz:TabablzControl.InterTabController>
- <dragablz:TabablzControl.HeaderSuffixContent>
- <Grid Name="TitleBarGrid" MinHeight="32" SnapsToDevicePixels="True">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="auto"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <Button x:Name="addBtn" Width="25" Height="25" Margin="9,0,0,0" HorizontalAlignment="Left" Background="Transparent" BorderThickness="0"
- Click="DefaultAddButton_Click" Template="{StaticResource AddFileButton}">
- </Button>
- <Grid Grid.Column="2" HorizontalAlignment="Right">
- <StackPanel Orientation="Horizontal" Margin="0,-2,0,0">
- <Button x:Name="SettingsBtn" Style="{StaticResource TitleBarButtonStyle}" Width="36" Height="32" Click="SettingsBtn_Click">
- <Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
- <Grid>
- <Path Data="M12 1.00391H4L0 8.00391L4 15.0039H12L16 8.00391L12 1.00391ZM11.4684 2.00293L14.8486 8.00293L11.4684 14.0029H4.53037L1.15015 8.00293L4.53037 2.00293H11.4684ZM8 4.9991C6.34315 4.9991 5 6.34224 5 7.9991C5 9.65595 6.34315 10.9991 8 10.9991C9.65685 10.9991 11 9.65595 11 7.9991C11 6.34224 9.65685 4.9991 8 4.9991ZM7.99992 6.17C9.0102 6.17 9.82919 6.98899 9.82919 7.99926C9.82919 9.00954 9.0102 9.82853 7.99992 9.82853C6.98965 9.82853 6.17065 9.00954 6.17065 7.99926C6.17065 6.98899 6.98965 6.17 7.99992 6.17" Fill="White"/>
- </Grid>
- </Viewbox>
- </Button>
- <Button x:Name="MinimizeButton" Style="{StaticResource TitleBarButtonStyle}" Width="36" Height="32" Click="MinimizeButton_Click">
- <Path Width="36" Height="32"
- Data="M 13,15 H 23"
- Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
- StrokeThickness="1" />
- </Button>
- <Button x:Name="MaximizeRestoreButton" Style="{StaticResource TitleBarButtonStyle}" Width="36" Height="32" Click="MaximizeRestoreButton_Click">
- <Path Width="36" Height="32"
- Data="{Binding ElementName=Window, Path=WindowState, Converter={StaticResource WindowStateToPathConverter}}"
- Stroke="{Binding Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
- StrokeThickness="1" />
- </Button>
- <Button x:Name="CloseButton" Style="{StaticResource TitleBarCloseButtonStyle}" Width="36" Height="32" Click="CloseButton_Click">
- <Path Width="36" Height="32"
- Data="M 13,11 22,20 M 13,20 22,11"
- Stroke="{Binding Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
- StrokeThickness="1" />
- </Button>
- </StackPanel>
- </Grid>
- </Grid>
- </dragablz:TabablzControl.HeaderSuffixContent>
- </dragablz:TabablzControl>
- <ContentControl x:Name="customContentControl">
- <ContentControl.Margin>
- <Binding Path="ActualHeight" ElementName="TitleBarGrid" Converter="{StaticResource HeightToTopMarginConverter}" />
- </ContentControl.Margin>
- <ContentControl.Height>
- <MultiBinding Converter="{StaticResource HomePageHeightConverter}">
- <Binding ElementName="TabControl" Path="ActualHeight"></Binding>
- <Binding ElementName="TitleBarGrid" Path="ActualHeight"></Binding>
- </MultiBinding>
- </ContentControl.Height>
- <ContentControl.Visibility>
- <Binding Path="IsToggled" ElementName="HomePageButton" Converter="{StaticResource BoolToVisibleConverter}"></Binding>
- </ContentControl.Visibility>
- <cpdftools:HomePageControl x:Name="HomePageControl" Visibility="{Binding ElementName=customContentControl, Path=Visibility}"></cpdftools:HomePageControl>
- </ContentControl>
- </Grid>
- <Border Name="PopupBorder" Background="#A0000000" Visibility="Collapsed">
- <cpdfcommon:PasswordDialog x:Name="PasswordUI" Visibility="Collapsed"></cpdfcommon:PasswordDialog>
- </Border>
- </Grid>
- </Window>
|