-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
258 lines (227 loc) · 15.7 KB
/
MainWindow.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
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<Window x:Class="WpfAppDemo1.MainWindow"
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"
xmlns:local="clr-namespace:WpfAppDemo1"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="思政题目练习--作者:WHX" Height="550" Width="1100" Closed="MainWindow_OnClosed"
WindowStyle="None" AllowsTransparency="True" MouseMove="MainWindow_OnMouseMove">
<Window.Resources>
<local:IOptionButtonConverter x:Key="Converter" />
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" SnapsToDevicePixels="true"
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
StrokeThickness="1" StrokeDashArray="1 2" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD" />
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070" />
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4" />
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5" />
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383" />
<Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
<Setter Property="Background" Value="{StaticResource Button.Static.Background}" />
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}" RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border"
Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
</Trigger>
<!--<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>-->
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border"
Value="{StaticResource Button.Disabled.Background}" />
<Setter Property="BorderBrush" TargetName="border"
Value="{StaticResource Button.Disabled.Border}" />
<Setter Property="TextElement.Foreground" TargetName="contentPresenter"
Value="{StaticResource Button.Disabled.Foreground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid ShowGridLines="False">
<Grid.RowDefinitions>
<RowDefinition MaxHeight="35"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Background="LightGray">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6*"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Name="TitleText" Margin="10 0 0 0" Text="思政答题练习 作者:WHX" VerticalAlignment="Center" FontSize="13"></TextBlock>
<UniformGrid Grid.Column="1" Columns="3">
<Button Content="——" FontWeight="Black" Margin="5 0 5 0" FontSize="12" Foreground="Black" Background="Transparent" BorderThickness="0" Click="ButtonMinWindow_OnClick"></Button>
<Button Content="□" FontWeight="Black" Margin="5 0 0 0" FontSize="20" Foreground="Black" Background="Transparent" BorderThickness="0" Click="ButtonMaxWindow_OnClick"></Button>
<Button Content="x" FontWeight="Heavy" Margin="5 0 5 0" FontSize="20" Foreground="Red" Background="Transparent" BorderThickness="0" Click="ButtonClose_OnClick"></Button>
</UniformGrid>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.4*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="1.4*" />
</Grid.ColumnDefinitions>
<!--左侧菜单-->
<Grid Grid.Column="0" Background="LightCyan" ShowGridLines="False">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="3*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<UniformGrid Grid.Row="0" Rows="3">
<!--<CheckBox Content="考试模式" IsEnabled="False" IsChecked="{Binding IsTestMode}" VerticalAlignment="Center"
HorizontalAlignment="Left" Margin="5" FontSize="13" />-->
<CheckBox Content="做过的题目直接显示答案" IsChecked="{Binding IsAnswerDisplay}" VerticalAlignment="Center"
HorizontalAlignment="Left" Margin="5" FontSize="13" />
<CheckBox Content="自动跳转下一题目" IsChecked="{Binding IsAutomaticMoveNext}" VerticalAlignment="Center"
HorizontalAlignment="Left" Margin="5" FontSize="13" />
<CheckBox Content="下一个题目随机" IsChecked="{Binding IsRandomQuestion}" VerticalAlignment="Center"
HorizontalAlignment="Left" Margin="5" FontSize="13" />
</UniformGrid>
<UniformGrid Grid.Row="1" Rows="5">
<Button Content="全部题目" Style="{StaticResource ButtonStyle1}" FontSize="20"
Command="{Binding OptionButtonCommand}" CommandParameter="全部"
Background="{Binding OptionAllQuestionSelected,Converter={StaticResource Converter}}" />
<Button Content="近代史纲要" Style="{StaticResource ButtonStyle1}" FontSize="20"
Command="{Binding OptionButtonCommand}" CommandParameter="近代史"
Background="{Binding OptionCMHSelected,Converter={StaticResource Converter}}" />
<Button Content="思想道德修养" Style="{StaticResource ButtonStyle1}" FontSize="20"
Command="{Binding OptionButtonCommand}" CommandParameter="思修"
Background="{Binding OptionIMCSelected,Converter={StaticResource Converter}}" />
<Button Content="马克思主义基本原理" Style="{StaticResource ButtonStyle1}" FontSize="20"
Command="{Binding OptionButtonCommand}" CommandParameter="马原"
Background="{Binding OptionBTMSelected,Converter={StaticResource Converter}}" />
<Button Content="毛泽东思想概论" Style="{StaticResource ButtonStyle1}" FontSize="20"
Command="{Binding OptionButtonCommand}" CommandParameter="毛概"
Background="{Binding OptionMTSelected,Converter={StaticResource Converter}}" />
</UniformGrid>
<StackPanel Grid.Row="2" Orientation="Vertical">
<TextBlock Height="20" Text="输入关键字筛选题目:" Margin="5 5 0 0" FontSize="15" />
<TextBox Name="TextBox1" Height="23" Margin="5 0 5 0" FontSize="15" />
<Button Height="30" Margin="5" Content="搜索题目" Command="{Binding OptionButtonCommand}"
CommandParameter="{Binding ElementName=TextBox1,Path=Text}" />
</StackPanel>
</Grid>
<!--右侧按钮-->
<Grid Grid.Column="2" ShowGridLines="False" Background="LightCyan">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="9*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Vertical">
<TextBlock Text="{Binding StatisticsDone}" Foreground="MediumVioletRed" FontSize="16"
FontWeight="Black" TextAlignment="Center" />
<TextBlock Text="{Binding CorrectRate}" Foreground="Green" FontSize="16" FontWeight="Black"
TextAlignment="Center" />
</StackPanel>
<ScrollViewer Grid.Row="1">
<ItemsControl Name="ItemsControl" Grid.Column="1">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button MinWidth="35" Margin="5" BorderBrush="Transparent" Height="30" Foreground="Black" Content="{Binding Number}"
Background="{Binding BackGroundSolidColorBrush}" Click="ButtonBase_OnClick"
HorizontalAlignment="Stretch" >
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<UniformGrid Grid.Row="2" Columns="2">
<Button Content="上一页" Margin="5" FontSize="15"
Command="{Binding LastButtonInfoPage}" />
<Button Content="下一页" Margin="5" FontSize="15"
Command="{Binding NextButtonInfoPage}" />
</UniformGrid>
</Grid>
<Border Grid.Column="1" BorderBrush="DarkGray" BorderThickness="2 2 2 2"></Border>
<!--中间内容Grid-->
<Grid Grid.Column="1" ShowGridLines="False" Background="Beige">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="3*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!--下侧按钮-->
<UniformGrid Grid.Row="3" Columns="3">
<Button Content="上一题" MinHeight="50" FontSize="18" Margin="15"
Command="{Binding LastButtonCommand}" />
<Button Content="确定" MinHeight="50" Background="Coral" BorderBrush="Transparent" FontSize="18"
Margin="15"
Command="{Binding SubmitButtonCommand}" />
<Button Content="下一题" MinHeight="50" FontSize="18" Margin="15"
Command="{Binding NextButtonCommand}" />
</UniformGrid>
<!--上侧问题显示区-->
<ScrollViewer Grid.Row="0" Margin="10 10 0 0">
<TextBlock TextWrapping="Wrap" Text="{Binding QuestionText}" FontSize="19" Background="Beige" />
</ScrollViewer>
<!--选项按钮-->
<UniformGrid Grid.Row="1" Rows="4" Margin="0 10 0 10">
<Button Name="ButtonA" MinHeight="40"
Background="{Binding OptionASelected,Converter={StaticResource Converter}}"
Content="{Binding OptionAText}" Command="{Binding OptionButtonCommand}" CommandParameter="_A_"
FontSize="14" Margin="10 0" Style="{DynamicResource ButtonStyle1}" />
<Button Name="ButtonB" MinHeight="40"
Background="{Binding OptionBSelected,Converter={StaticResource Converter}}"
Content="{Binding OptionBText}" Command="{Binding OptionButtonCommand}" CommandParameter="_B_"
FontSize="14" Margin="10 0" Style="{DynamicResource ButtonStyle1}" />
<Button Name="ButtonC" MinHeight="40"
Background="{Binding OptionCSelected,Converter={StaticResource Converter}}"
Content="{Binding OptionCText}" Command="{Binding OptionButtonCommand}" CommandParameter="_C_"
FontSize="14" Margin="10 0" Style="{DynamicResource ButtonStyle1}" />
<Button Name="ButtonD" MinHeight="40"
Background="{Binding OptionDSelected,Converter={StaticResource Converter}}"
Content="{Binding OptionDText}" Command="{Binding OptionButtonCommand}" CommandParameter="_D_"
FontSize="14" Margin="10 0" Style="{DynamicResource ButtonStyle1}" />
</UniformGrid>
<ScrollViewer Grid.Row="2" Margin="10 10 0 0">
<TextBlock TextWrapping="Wrap" Text="{Binding AnswerText}" FontSize="25"
Foreground="OrangeRed" />
</ScrollViewer>
</Grid>
</Grid>
</Grid>
</Window>