123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <UserControl x:Class="Compdfkit_Tools.PDFControlUI.CPDFScalingUI"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
- mc:Ignorable="d"
- d:DesignHeight="30" d:DesignWidth="162">
- <UserControl.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="../../../Asset/Styles/ToggleButtonStyle.xaml"></ResourceDictionary>
- <ResourceDictionary Source="../../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
- </ResourceDictionary.MergedDictionaries>
- <cpdfcommon:CommonResourceConverter x:Key="CommonResourceConverter"></cpdfcommon:CommonResourceConverter>
- <SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
- <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/>
- <SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5"/>
- <Style x:Key="LimitedNumberBoxWithUnit" TargetType="{x:Type TextBox}">
- <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
- <Setter Property="BorderBrush" Value="Transparent"/>
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
- <Setter Property="BorderThickness" Value="1"/>
- <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
- <Setter Property="HorizontalContentAlignment" Value="Left"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="AllowDrop" Value="true"/>
- <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
- <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type TextBox}">
- <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="11"/>
- </Grid.ColumnDefinitions>
- <ScrollViewer Grid.Column="0" x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Margin="5,0,0,0"/>
- <TextBlock Grid.Column="1" Text="%" HorizontalAlignment="Right" VerticalAlignment="Center"/>
- </Grid>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="TransparentToggleButton" TargetType="{x:Type ToggleButton}">
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="BorderBrush" Value="Transparent"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ToggleButton}">
- <Border x:Name="border"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Padding="{TemplateBinding Padding}">
- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- RecognizesAccessKey="True"/>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsChecked" Value="True">
- <Setter TargetName="border" Property="Opacity" Value="0"/>
- </Trigger>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="border" Property="Opacity" Value="0"/>
- </Trigger>
- <Trigger Property="IsPressed" Value="True">
- <Setter TargetName="border" Property="Opacity" Value="0"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="PresetComboBox" TargetType="{x:Type ComboBox}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ComboBox}">
- <Border x:Name="border" BorderBrush="{StaticResource TextBox.Static.Border}" BorderThickness="1" Background="#FFFFFF">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition></ColumnDefinition>
- <ColumnDefinition Width="15"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <Grid Grid.Column="1">
- <Path Fill="#CDCDCD" Stroke="#CDCDCD" Grid.Column="1" Height="4.8" Width="7.38" Stretch="Fill">
- <Path.Data>
- M0.5 0.510248L4.5041 5.5L8.5 0.5L0.5 0.510248Z
- </Path.Data>
- </Path>
-
- </Grid>
- <Grid Grid.Column="0" Grid.ColumnSpan="2">
- <ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
- ClickMode="Press" Style="{StaticResource TransparentToggleButton}"></ToggleButton>
- <Popup Name="popup"
- IsOpen="{TemplateBinding IsDropDownOpen}"
- Placement="Bottom" AllowsTransparency="True" PopupAnimation="Fade" VerticalOffset="1">
- <Border MinWidth="{TemplateBinding ActualWidth}"
- MaxHeight="{TemplateBinding MaxDropDownHeight}">
- <ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}"
- HorizontalScrollBarVisibility="Auto"
- VerticalScrollBarVisibility="Auto">
- <Border BorderBrush ="LightGray" BorderThickness="1">
- <StackPanel Background="#FFFFFF" MinHeight="20"
- IsItemsHost="True"/>
- </Border>
- </ScrollViewer>
- </Border>
- </Popup>
- </Grid>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.MouseOver.Border}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
- </UserControl.Resources>
- <Grid Height="30" Width="160" HorizontalAlignment="Left">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="72"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="1*"></ColumnDefinition>
- <ColumnDefinition Width="20"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <ComboBox Grid.ColumnSpan="2" x:Name="ZoomComboBox" Background="#FFFFFF" Style="{StaticResource PresetComboBox}" SelectionChanged="ZoomComboBox_SelectionChanged" ></ComboBox>
- <TextBox x:Name="ZoomTextBox" Style="{StaticResource LimitedNumberBoxWithUnit}" HorizontalContentAlignment="Center" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="TextBox_PreviewTextInput" PreviewKeyDown="TextBox_PreviewKeyDown" TextChanged="TextBox_TextChanged" LostFocus="ZoomTextBox_LostFocus">
- </TextBox>
- </Grid>
- <StackPanel Grid.Column="1" Orientation="Horizontal" >
- <Button x:Name="ScaleDecreaseButton" ToolTip="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Tooltip_ZoomOut}"
- Style="{StaticResource LightButtonStyle}" Height="30" Width="30" Margin="20,0,0,0" Background="Transparent" BorderThickness="0" Click="ScaleDecreaseButton_Click">
- <Button.Content>
- <Rectangle Width="12" Height="2" Fill="#0E1114"></Rectangle>
- </Button.Content>
- </Button>
- <Button x:Name="ScaleIncreaseButton" ToolTip="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Tooltip_ZoomIn}"
- Style="{StaticResource LightButtonStyle}" Height="30" Width="30" BorderThickness="0" Background="Transparent" Margin="10,0,0,0" Click="ScaleIncreaseButton_Click">
- <Button.Content>
- <Path Fill="#0E1114">
- <Path.Data>
- M7.625 6.375V0.75H6.375V6.375H0.75V7.625H6.375V13.25H7.625V7.625H13.25V6.375H7.625Z
- </Path.Data>
- </Path>
- </Button.Content>
- </Button>
- </StackPanel>
- </Grid>
- </UserControl>
|