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
116
117
118
119
120
121
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Tango.Touch.Converters"
xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop"
xmlns:local="clr-namespace:Tango.Touch.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<converters:ScrollViewerThumbSizeConverter x:Key="ScrollViewerThumbSizeConverter" />
<converters:ScrollViewerScrollBarVisibilityConverter x:Key="ScrollViewerScrollBarVisibilityConverter" />
<converters:SizeWidthToPointXConverter x:Key="SizeWidthToPointXConverter" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type local:LightTouchScrollViewer}">
<Setter Property="ScrollBarBackground" Value="#33000000"></Setter>
<Setter Property="ScrollBarForeground" Value="#90000000"></Setter>
<Setter Property="ScrollBarWidth" Value="5"></Setter>
<Setter Property="ScrollBarCornerRadius" Value="3"></Setter>
<Setter Property="Focusable" Value="True"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:LightTouchScrollViewer}">
<Grid>
<Border x:Name="PART_Border" ClipToBounds="True" Background="Transparent">
<Grid x:Name="PART_Grid_Content" Background="Transparent" VerticalAlignment="Top" Height="{Binding ElementName=stack,Path=ActualHeight,Mode=OneWay}">
<StackPanel x:Name="stack" VerticalAlignment="Top">
<!--<StackPanel.CacheMode>
<BitmapCache SnapsToDevicePixels="False" RenderAtScale="1" EnableClearType="False" />
</StackPanel.CacheMode>-->
<ContentPresenter x:Name="PART_Content_Presenter" Content="{TemplateBinding Content}" VerticalAlignment="Top" Height="Auto" />
</StackPanel>
</Grid>
</Border>
<Path>
<Path.Fill>
<LinearGradientBrush>
<GradientStop Color="#18D3D3D3" Offset="0"/>
<GradientStop Color="#20929292" Offset="0.5" />
<GradientStop Color="#18D3D3D3" Offset="1"/>
</LinearGradientBrush>
</Path.Fill>
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="0,0">
<ArcSegment Point="{Binding RelativeSource={RelativeSource TemplatedParent},Path=ActualWidth,Converter={StaticResource SizeWidthToPointXConverter}}" Size="{Binding RelativeSource={RelativeSource TemplatedParent},Path=TopArcSize}"/>
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
<Path RenderTransformOrigin="0.5,0.5">
<Path.Fill>
<LinearGradientBrush>
<GradientStop Color="#18D3D3D3" Offset="0"/>
<GradientStop Color="#20929292" Offset="0.5" />
<GradientStop Color="#18D3D3D3" Offset="1"/>
</LinearGradientBrush>
</Path.Fill>
<Path.RenderTransform>
<ScaleTransform ScaleY="-1" />
</Path.RenderTransform>
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="0,0">
<ArcSegment Point="{Binding RelativeSource={RelativeSource TemplatedParent},Path=ActualWidth,Converter={StaticResource SizeWidthToPointXConverter}}" Size="{Binding RelativeSource={RelativeSource TemplatedParent},Path=BottomArcSize}"/>
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
<Grid HorizontalAlignment="Right" VerticalAlignment="Stretch" Visibility="{TemplateBinding ScrollBarVisibility}">
<Canvas Margin="{TemplateBinding ScrollBarMargin}" x:Name="PART_canvas" HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="{TemplateBinding ScrollBarWidth}" Background="{TemplateBinding ScrollBarBackground}">
<Canvas.Visibility>
<MultiBinding Converter="{StaticResource ScrollViewerScrollBarVisibilityConverter}">
<Binding ElementName="PART_Border" Path="ActualHeight" />
<Binding ElementName="PART_Grid_Content" Path="ActualHeight" />
</MultiBinding>
</Canvas.Visibility>
<Canvas.Style>
<Style TargetType="Canvas">
<Setter Property="Opacity" Value="0"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsScrolling}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.2"/>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" BeginTime="00:00:01" Duration="00:00:01"/>
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Canvas.Style>
<Border x:Name="PART_Thumb_Border" CornerRadius="{TemplateBinding ScrollBarCornerRadius}" Canvas.Top="0" Width="{Binding ElementName=PART_canvas,Path=ActualWidth}" Background="{TemplateBinding ScrollBarForeground}">
<Border.Height>
<MultiBinding Converter="{StaticResource ScrollViewerThumbSizeConverter}">
<Binding ElementName="PART_Border" Path="ActualHeight" />
<Binding ElementName="PART_Grid_Content" Path="ActualHeight" />
</MultiBinding>
</Border.Height>
<Thumb x:Name="PART_Thumb" Opacity="0" Background="Transparent" />
</Border>
</Canvas>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
|