193 lines
18 KiB
XML
193 lines
18 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:hc="clr-namespace:HandyControl.Controls"
|
|
xmlns:langs="clr-namespace:HandyControl.Properties.Langs"
|
|
xmlns:themes="clr-namespace:HandyControl.Themes">
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Sizes.xaml"/>
|
|
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Basic/Geometries.xaml"/>
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<Style x:Key="FlowDocumentScrollViewerBaseStyle" TargetType="FlowDocumentScrollViewer">
|
|
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="FlowDocumentScrollViewer">
|
|
<DockPanel Background="{TemplateBinding Background}" LastChildFill="True">
|
|
<Grid x:Name="PART_ToolBarHost" Panel.ZIndex="1" DockPanel.Dock="Bottom" Margin="0,6">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Border x:Name="PART_FindToolBarHost" Grid.Column="0" HorizontalAlignment="Left" Visibility="Collapsed" VerticalAlignment="Center"/>
|
|
<Grid Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<RepeatButton Height="20" Width="20" Padding="5,8" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource SubGeometry}" Grid.Column="0" Command="NavigationCommands.DecreaseZoom" IsEnabled="{TemplateBinding CanDecreaseZoom}" ToolTip="{x:Static langs:Lang.ZoomOut}"/>
|
|
<Slider hc:TipElement.Visibility="Visible" hc:TipElement.Placement="Top" Grid.Column="1" HorizontalAlignment="Stretch" LargeChange="{TemplateBinding ZoomIncrement}" Maximum="{TemplateBinding MaxZoom}" Minimum="{TemplateBinding MinZoom}" SmallChange="{TemplateBinding ZoomIncrement}" TickFrequency="{TemplateBinding ZoomIncrement}" Value="{Binding Zoom, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center" Width="180"/>
|
|
<RepeatButton Height="20" Width="20" Padding="4" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource AddGeometry}" Grid.Column="2" Command="NavigationCommands.IncreaseZoom" IsEnabled="{TemplateBinding CanIncreaseZoom}" ToolTip="{x:Static langs:Lang.ZoomIn}"/>
|
|
</Grid>
|
|
</Grid>
|
|
<Border Panel.ZIndex="0" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
|
<ScrollViewer x:Name="PART_ContentHost" CanContentScroll="True" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
|
</Border>
|
|
</DockPanel>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="FlowDocumentPageViewerBaseStyle" TargetType="FlowDocumentPageViewer">
|
|
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="FlowDocumentPageViewer">
|
|
<DockPanel Background="{TemplateBinding Background}" LastChildFill="True">
|
|
<Grid Panel.ZIndex="1" DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" Margin="0,6">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Border x:Name="PART_FindToolBarHost" Grid.Column="0" HorizontalAlignment="Left" Visibility="Collapsed" VerticalAlignment="Center"/>
|
|
<StackPanel Grid.Column="1" HorizontalAlignment="Center" Orientation="Horizontal" VerticalAlignment="Center">
|
|
<RepeatButton Height="20" Width="20" Padding="4" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource LeftGeometry}" Command="NavigationCommands.PreviousPage" IsEnabled="{TemplateBinding CanGoToPreviousPage}" ToolTip="{x:Static langs:Lang.PreviousPage}"/>
|
|
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
<Run Text=" "/>
|
|
<InlineUIContainer>
|
|
<TextBlock Text="{Binding MasterPageNumber, RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
</InlineUIContainer>
|
|
<Run Text=" "/>
|
|
<Run Text="/"/>
|
|
<Run Text=" "/>
|
|
<InlineUIContainer>
|
|
<TextBlock Text="{Binding PageCount, RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
</InlineUIContainer>
|
|
<Run Text=" "/>
|
|
</TextBlock>
|
|
<RepeatButton Height="20" Width="20" Padding="4" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource RightGeometry}" Command="NavigationCommands.NextPage" IsEnabled="{TemplateBinding CanGoToNextPage}" ToolTip="{x:Static langs:Lang.NextPage}"/>
|
|
</StackPanel>
|
|
<Grid Grid.Column="2" VerticalAlignment="Center" Margin="32,0,0,0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<RepeatButton Height="20" Width="20" Padding="5,8" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource SubGeometry}" Grid.Column="0" Command="NavigationCommands.DecreaseZoom" IsEnabled="{TemplateBinding CanDecreaseZoom}" ToolTip="{x:Static langs:Lang.ZoomOut}"/>
|
|
<Slider hc:TipElement.Visibility="Visible" hc:TipElement.Placement="Top" Grid.Column="1" HorizontalAlignment="Stretch" LargeChange="{TemplateBinding ZoomIncrement}" Maximum="{TemplateBinding MaxZoom}" Minimum="{TemplateBinding MinZoom}" SmallChange="{TemplateBinding ZoomIncrement}" TickFrequency="{TemplateBinding ZoomIncrement}" Value="{Binding Zoom, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center"/>
|
|
<RepeatButton Height="20" Width="20" Padding="4" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource AddGeometry}" Grid.Column="2" Command="NavigationCommands.IncreaseZoom" IsEnabled="{TemplateBinding CanIncreaseZoom}" ToolTip="{x:Static langs:Lang.ZoomIn}"/>
|
|
</Grid>
|
|
</Grid>
|
|
<Border Panel.ZIndex="0" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
|
<AdornerDecorator>
|
|
<DocumentPageView HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" DocumentPaginator="{x:Null}" KeyboardNavigation.IsTabStop="False" DocumentViewerBase.IsMasterPage="True" PageNumber="0" KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local"/>
|
|
</AdornerDecorator>
|
|
</Border>
|
|
</DockPanel>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="FlowDocumentReaderBaseStyle" TargetType="FlowDocumentReader">
|
|
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="FlowDocumentReader">
|
|
<DockPanel Background="{TemplateBinding Background}" LastChildFill="True">
|
|
<Grid Panel.ZIndex="1" DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" Margin="0,6">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Orientation="Horizontal">
|
|
<ToggleButton Width="24" Height="24" Padding="5" x:Name="FindButton" hc:IconElement.Geometry="{StaticResource SearchGeometry}" Command="ApplicationCommands.Find" Margin="0,0,10,0" ToolTip="{x:Static langs:Lang.Find}"/>
|
|
<Border x:Name="PART_FindToolBarHost" HorizontalAlignment="Left" Visibility="Collapsed" VerticalAlignment="Center"/>
|
|
</StackPanel>
|
|
<StackPanel x:Name="PageCountAndButtons" Grid.Column="1" HorizontalAlignment="Center" Orientation="Horizontal" VerticalAlignment="Center">
|
|
<RepeatButton Height="20" Width="20" Padding="4" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource LeftGeometry}" Command="NavigationCommands.PreviousPage" IsEnabled="{TemplateBinding CanGoToPreviousPage}" ToolTip="{x:Static langs:Lang.PreviousPage}"/>
|
|
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
<Run Text=" "/>
|
|
<InlineUIContainer>
|
|
<TextBlock Text="{Binding PageNumber, RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
</InlineUIContainer>
|
|
<Run Text=" "/>
|
|
<Run Text="/"/>
|
|
<Run Text=" "/>
|
|
<InlineUIContainer>
|
|
<TextBlock Text="{Binding PageCount, RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
</InlineUIContainer>
|
|
<Run Text=" "/>
|
|
</TextBlock>
|
|
<RepeatButton Height="20" Width="20" Padding="4" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource RightGeometry}" Command="NavigationCommands.NextPage" IsEnabled="{TemplateBinding CanGoToNextPage}" ToolTip="{x:Static langs:Lang.NextPage}"/>
|
|
</StackPanel>
|
|
<Grid Grid.Column="2" Margin="32,0,0,0" VerticalAlignment="Center">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<hc:ButtonGroup Width="90">
|
|
<RadioButton x:Name="PageViewButton" Padding="0" hc:IconElement.Geometry="{StaticResource PageModeGeometry}" CommandParameter="Page" Command="FlowDocumentReader.SwitchViewingModeCommand" GroupName="ViewingMode" IsEnabled="{TemplateBinding IsPageViewEnabled}" ToolTip="{x:Static langs:Lang.PageMode}"/>
|
|
<RadioButton x:Name="TwoPageViewButton" hc:IconElement.Geometry="{StaticResource TwoPageModeGeometry}" Padding="0" CommandParameter="TwoPage" Command="FlowDocumentReader.SwitchViewingModeCommand" GroupName="ViewingMode" IsEnabled="{TemplateBinding IsTwoPageViewEnabled}" ToolTip="{x:Static langs:Lang.TwoPageMode}"/>
|
|
<RadioButton x:Name="ScrollViewButton" hc:IconElement.Geometry="{StaticResource ScrollModeGeometry}" Padding="0" CommandParameter="Scroll" Command="FlowDocumentReader.SwitchViewingModeCommand" GroupName="ViewingMode" IsEnabled="{TemplateBinding IsScrollViewEnabled}" ToolTip="{x:Static langs:Lang.ScrollMode}"/>
|
|
</hc:ButtonGroup>
|
|
<RepeatButton Margin="32,0,0,0" Height="20" Width="20" Padding="5,8" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource SubGeometry}" Grid.Column="1" Command="NavigationCommands.DecreaseZoom" IsEnabled="{TemplateBinding CanDecreaseZoom}" ToolTip="{x:Static langs:Lang.ZoomOut}"/>
|
|
<Slider hc:TipElement.Visibility="Visible" hc:TipElement.Placement="Top" Grid.Column="2" HorizontalAlignment="Stretch" LargeChange="{TemplateBinding ZoomIncrement}" Maximum="{TemplateBinding MaxZoom}" Minimum="{TemplateBinding MinZoom}" SmallChange="{TemplateBinding ZoomIncrement}" TickFrequency="{TemplateBinding ZoomIncrement}" Value="{Binding Zoom, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center"/>
|
|
<RepeatButton Height="20" Width="20" Padding="4" hc:BorderElement.CornerRadius="10" hc:IconElement.Geometry="{StaticResource AddGeometry}" Grid.Column="3" Command="NavigationCommands.IncreaseZoom" IsEnabled="{TemplateBinding CanIncreaseZoom}" ToolTip="{x:Static langs:Lang.ZoomIn}"/>
|
|
</Grid>
|
|
</Grid>
|
|
<Border Panel.ZIndex="0" x:Name="PART_ContentHost" KeyboardNavigation.IsTabStop="False" KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{TemplateBinding Padding}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
</DockPanel>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="ViewingMode" Value="Page">
|
|
<Setter Property="IsChecked" TargetName="PageViewButton" Value="True"/>
|
|
</Trigger>
|
|
<Trigger Property="ViewingMode" Value="TwoPage">
|
|
<Setter Property="IsChecked" TargetName="TwoPageViewButton" Value="True"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
</Trigger>
|
|
<Trigger Property="ViewingMode" Value="Scroll">
|
|
<Setter Property="IsChecked" TargetName="ScrollViewButton" Value="True"/>
|
|
<Setter Property="Visibility" TargetName="PageCountAndButtons" Value="Collapsed"/>
|
|
</Trigger>
|
|
<Trigger Property="Document" Value="{x:Null}">
|
|
<Setter Property="IsEnabled" TargetName="FindButton" Value="False"/>
|
|
</Trigger>
|
|
<Trigger Property="IsFindEnabled" Value="False">
|
|
<Setter Property="IsEnabled" TargetName="FindButton" Value="False"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
</ResourceDictionary> |