-
Notifications
You must be signed in to change notification settings - Fork 7.9k
/
Copy pathScenario7.xaml
150 lines (145 loc) · 9.42 KB
/
Scenario7.xaml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!--
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
-->
<Page
x:Class="SDKTemplate.Scenario7"
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"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid x:Name="RootGrid" Margin="12,20,12,12">
<Grid.Resources>
<Style x:Key="InkRulerRepositionButtonStyle" TargetType="Button">
<Setter Property="MinWidth" Value="{ThemeResource InkToolbarButtonWidth}"/>
<Setter Property="MinHeight" Value="{ThemeResource InkToolbarButtonHeight}"/>
<Setter Property="MaxWidth" Value="{ThemeResource InkToolbarButtonWidth}"/>
<Setter Property="MaxHeight" Value="{ThemeResource InkToolbarButtonHeight}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="{ThemeResource InkToolbarButtonBackgroundThemeBrush}"/>
<Setter Property="Foreground" Value="{ThemeResource InkToolbarButtonForegroundThemeBrush}"/>
</Style>
<Style x:Key="InkRulerRepositionButton" TargetType="Button" BasedOn="{StaticResource InkRulerRepositionButtonStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="RootElement" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="ContentGrid.Background" Value="{ThemeResource InkToolbarButtonHoverBackgroundThemeBrush}"/>
<Setter Target="Content.Stroke" Value="{ThemeResource InkToolbarButtonHoverForegroundThemeBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Target="ContentGrid.Background" Value="{ThemeResource InkToolbarButtonPressedBackgroundThemeBrush}"/>
<Setter Target="Content.Stroke" Value="{ThemeResource InkToolbarButtonPressedForegroundThemeBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="ContentGrid.Opacity" Value="0.5"/>
<Setter Target="ContentViewOutline.Opacity" Value="0.5"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="ContentGrid"
Width="{ThemeResource InkToolbarButtonWidth}"
Height="{ThemeResource InkToolbarButtonHeight}"
Margin="0" HorizontalAlignment="Center">
<Path x:Name="Content" Width="31" Height="31"
HorizontalAlignment="Center" VerticalAlignment="Center"
Stroke="{ThemeResource InkToolbarButtonForegroundThemeBrush}">
<Path.Data>
<GeometryGroup>
<LineGeometry StartPoint="6,16" EndPoint="24,16"/>
<LineGeometry StartPoint="6,16" EndPoint="6,30"/>
<LineGeometry StartPoint="6,30" EndPoint="24,30"/>
<LineGeometry StartPoint="10,16" EndPoint="10,19"/>
<LineGeometry StartPoint="14,16" EndPoint="14,20"/>
<LineGeometry StartPoint="18,16" EndPoint="18,19"/>
<LineGeometry StartPoint="22,16" EndPoint="22,20"/>
</GeometryGroup>
</Path.Data>
</Path>
<Path x:Name="ContentViewOutline" Width="31" Height="31"
HorizontalAlignment="Center" VerticalAlignment="Center"
Stroke="Turquoise">
<Path.Data>
<GeometryGroup>
<LineGeometry StartPoint="16,12" EndPoint="6,2"/>
<LineGeometry StartPoint="6,2" EndPoint="6,7"/>
<LineGeometry StartPoint="6,2" EndPoint="11,2"/>
</GeometryGroup>
</Path.Data>
</Path>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="0,0,0,10">
<TextBlock Text="Description:" Style="{StaticResource SampleHeaderTextStyle}"/>
<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap">
This scenario we demonstrates how to work with InkPresenterRuler in a ScrollViewer and how to reposition the InkPresenterRuler on demand.
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="1"
Orientation="Horizontal"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{ThemeResource SystemChromeMediumColor}">
<InkToolbar x:Name="inkToolbar" HorizontalAlignment="Left" TargetInkCanvas="{x:Bind inkCanvas}"
IsStencilButtonCheckedChanged="InkToolbar_IsStencilButtonCheckedChanged"/>
<Line Y1="0"
Y2="{ThemeResource InkToolbarButtonHeight}"
HorizontalAlignment="Stretch"
Width="2"
Height="{ThemeResource InkToolbarButtonHeight}"
StrokeThickness="2"
Stroke="Gray"/>
<Button x:Name="BringIntoViewButton"
IsEnabled="False"
Click="OnBringIntoView"
Style="{StaticResource InkRulerRepositionButton}">
</Button>
</StackPanel>
<ScrollViewer x:Name="ScrollViewer"
Grid.Row="2"
ZoomMode="Enabled"
MinZoomFactor="1"
MaxZoomFactor="6"
VerticalScrollMode="Enabled"
VerticalScrollBarVisibility="Visible"
HorizontalScrollMode="Enabled"
HorizontalScrollBarVisibility="Visible"
Background="{ThemeResource SystemControlBackgroundChromeWhiteBrush}">
<Grid x:Name="OutputGrid" Background="{ThemeResource SystemControlBackgroundChromeWhiteBrush}">
<!-- Inking area -->
<InkCanvas x:Name="inkCanvas"/>
</Grid>
</ScrollViewer>
</Grid>
</Grid>
</Page>