UsrPrintTemplatebottom.xaml
11.6 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<UserControl x:Class="SmartScan.SetControl.WPF.UsrPrintTemplatebottom"
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:local="clr-namespace:SmartScan.SetControl.WPF"
mc:Ignorable="d" Loaded="UserControl_Loaded"
Background="#1a1a1a">
<UserControl.Resources>
<!-- 通用样式 -->
<Style x:Key="LabelStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="White"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Margin" Value="5,0"/>
</Style>
<!-- 标题样式 -->
<Style x:Key="HeaderStyle" TargetType="TextBlock" BasedOn="{StaticResource LabelStyle}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
<!-- 蓝色边框样式 -->
<Style x:Key="BlueBorderStyle" TargetType="Border">
<Setter Property="BorderBrush" Value="#0078d7"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2"
Background="Transparent"
BorderBrush="#444444"
BorderThickness="1" />
<Border Grid.Column="1"
Background="Transparent"
BorderBrush="#444444"
BorderThickness="0,0,0,0" />
</Grid>
</ControlTemplate>
<!-- 按钮样式 -->
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#1c1c1c"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="#0078d7"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="40"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="10,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#0078d7"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#005a9e"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 下拉框样式 -->
<Style x:Key="ComboBoxStyle" TargetType="ComboBox">
<Setter Property="Background" Value="#1c1c1c"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="#0078d7"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="32"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<!-- 复选框样式 -->
<Style x:Key="CheckBoxStyle" TargetType="CheckBox">
<Setter Property="Foreground" Value="White"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="14"/>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 标题栏 -->
<Border Grid.Row="0" Style="{StaticResource BlueBorderStyle}" Background="#0078d7">
<TextBlock Text="字段操作" Name="UsrPrintTemplate_facePanel7" Style="{StaticResource HeaderStyle}" Padding="0,5"/>
</Border>
<!-- 字段类型和显示关键字选项 -->
<Grid Grid.Row="1" Margin="0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="字段类型" Name="UsrPrintTemplate_LblFieldType" Grid.Column="0" Style="{StaticResource LabelStyle}" HorizontalAlignment="Left" Margin="5,0"/>
<ComboBox x:Name="CboFieldType" Foreground="White" Grid.Column="1" Margin="5,0,10,0">
<ComboBox.Resources>
<!-- 下拉菜单背景色 -->
<SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="#222222"/>
<!-- 选中项背景色 -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#444444"/>
</ComboBox.Resources>
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
<Style.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" Value="#444444"/>
</Trigger>
</Style.Triggers>
</Style>
</ComboBox.ItemContainerStyle>
<!-- 设置下拉箭头样式 -->
<ComboBox.Style>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Grid>
<ToggleButton x:Name="ToggleButton"
ClickMode="Press"
Focusable="false"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Template="{StaticResource ComboBoxToggleButton}"/>
<ContentPresenter x:Name="ContentSite"
IsHitTestVisible="False"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
Margin="8,3,32,3"
VerticalAlignment="Center"
HorizontalAlignment="Left"/>
<Path x:Name="Arrow"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,8,0"
Fill="White"
Data="M 0 0 L 6 6 L 12 0 Z"/>
<Popup x:Name="Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide">
<Grid x:Name="DropDown"
SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder"
Background="#222222"
BorderThickness="1"
BorderBrush="#444444"/>
<ScrollViewer SnapsToDevicePixels="True">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"/>
</ScrollViewer>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ComboBox.Style>
</ComboBox>
<CheckBox x:Name="UsrPrintTemplate_ChkFieldShowKey" Content="显示关键字" Grid.Column="2"
Style="{StaticResource CheckBoxStyle}" VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Grid>
<!-- 操作按钮 - 第一行 -->
<Grid Grid.Row="2" Margin="0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="UsrPrintTemplate_BtnAddField" Content="添加字段" Grid.Column="0" Style="{StaticResource ButtonStyle}" Margin="5"/>
<Button x:Name="UsrPrintTemplate_BtnDelField" Content="删除字段" Grid.Column="1" Style="{StaticResource ButtonStyle}" Margin="5"/>
<Button x:Name="UsrPrintTemplate_BtnFieldFont" Content="字段字体" Grid.Column="2" Style="{StaticResource ButtonStyle}" Margin="5"/>
<Button x:Name="UsrPrintTemplate_BtnSetField" Content="设置字段内容" Grid.Column="3" Style="{StaticResource ButtonStyle}" Margin="5"/>
<Button x:Name="UsrPrintTemplate_BtnPrintTest" Content="打印测试" Grid.Column="4" Style="{StaticResource ButtonStyle}" />
</Grid>
<!-- 操作按钮 - 第二行 -->
<Grid Grid.Row="3" Margin="0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
</Grid>
<!-- 底部的打印测试按钮 -->
</Grid>
</UserControl>