This repository was archived by the owner on Oct 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 805
Expand file tree
/
Copy pathZoomScrollViewer.xaml
More file actions
115 lines (112 loc) · 6.36 KB
/
ZoomScrollViewer.xaml
File metadata and controls
115 lines (112 loc) · 6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.SharpDevelop.Widgets">
<Style TargetType="{x:Type Controls:ZoomScrollViewer}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:ZoomScrollViewer}">
<Grid Background="{TemplateBinding Panel.Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Controls:SelfCollapsingPanel Grid.Column="0" Grid.Row="1" CollapseOrientation="Horizontal" CanCollapse="{Binding Path=ComputedZoomButtonCollapsed, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}">
<Controls:ZoomButtons x:Name="zoomButtons" Value="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}" Minimum="{TemplateBinding MinimumZoom}" Maximum="{TemplateBinding MaximumZoom}" />
</Controls:SelfCollapsingPanel>
<Rectangle Grid.Column="2" Grid.Row="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
<ScrollContentPresenter Name="PART_Presenter" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" Margin="{TemplateBinding Control.Padding}" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}">
<ScrollContentPresenter.LayoutTransform>
<ScaleTransform ScaleX="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}" ScaleY="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
</ScrollContentPresenter.LayoutTransform>
<TextOptions.TextFormattingMode>
<MultiBinding Converter="{x:Static Controls:ZoomToTextFormattingModeConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="CurrentZoom" />
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Content.Options.EnableTextAntialiasing" />
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Content.Options.EnableTextHinting" />
</MultiBinding>
</TextOptions.TextFormattingMode>
<TextOptions.TextRenderingMode>
<MultiBinding Converter="{x:Static Controls:ZoomToTextRenderingModeConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="CurrentZoom" />
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Content.Options.EnableTextAntialiasing" />
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Content.Options.EnableTextHinting" />
</MultiBinding>
</TextOptions.TextRenderingMode>
<TextOptions.TextHintingMode>
<MultiBinding Converter="{x:Static Controls:ZoomToTextHintingModeConverter.Instance}">
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="CurrentZoom" />
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Content.Options.EnableTextAntialiasing" />
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Content.Options.EnableTextHinting" />
</MultiBinding>
</TextOptions.TextHintingMode>
</ScrollContentPresenter>
<ScrollBar Name="PART_VerticalScrollBar" Grid.Column="2" Grid.Row="0" Minimum="0" Maximum="{TemplateBinding ScrollableHeight}" ViewportSize="{TemplateBinding ViewportHeight}" Value="{TemplateBinding VerticalOffset}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" />
<ScrollBar Name="PART_HorizontalScrollBar" Orientation="Horizontal" Grid.Column="1" Grid.Row="1" Minimum="0" Maximum="{TemplateBinding ScrollableWidth}" ViewportSize="{TemplateBinding ViewportWidth}" Value="{TemplateBinding HorizontalOffset}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ZoomButtonStyle"
TargetType="RepeatButton">
<Setter Property="Delay" Value="0" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Opacity" Value="0.5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<ContentPresenter />
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:ZoomButtons}">
<Setter Property="Minimum" Value="0.2"/>
<Setter Property="Maximum" Value="10"/>
<Setter Property="Value" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:ZoomButtons}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<StackPanel Orientation="Horizontal"
Background="#3000">
<RepeatButton x:Name="uxPlus"
Width="16" Height="16" Padding="0" BorderThickness="0"
Style="{StaticResource ZoomButtonStyle}">
<Image Source="Images/ZoomIn.png"
Stretch="Uniform"/>
</RepeatButton>
<RepeatButton x:Name="uxMinus"
Width="16" Height="16" Padding="0" BorderThickness="0"
Style="{StaticResource ZoomButtonStyle}">
<Image Source="Images/ZoomOut.png"
Stretch="Uniform" />
</RepeatButton>
<RepeatButton x:Name="uxReset"
Width="16" Height="16" Padding="0" BorderThickness="0"
Style="{StaticResource ZoomButtonStyle}">
<Border Background="#5000">
<TextBlock Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center">1</TextBlock>
</Border>
</RepeatButton>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>