UserTests.xaml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <Page x:Class="PsychoTest.Pages.UserTests"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:PsychoTest.Pages"
  7. mc:Ignorable="d"
  8. d:DesignHeight="1024" d:DesignWidth="1440"
  9. Title="UserTests"
  10. xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2">
  11. <Page.Resources>
  12. <LinearGradientBrush x:Key="ComboBox.Static.Background" EndPoint="0,1" StartPoint="0,0">
  13. <GradientStop Color="#FFF0F0F0" Offset="0.0"/>
  14. <GradientStop Color="#FFE5E5E5" Offset="1.0"/>
  15. </LinearGradientBrush>
  16. <SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC"/>
  17. <SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF606060"/>
  18. <SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="#FFFFFFFF"/>
  19. <SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="#FFABADB3"/>
  20. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent"/>
  21. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent"/>
  22. <LinearGradientBrush x:Key="ComboBox.MouseOver.Background" EndPoint="0,1" StartPoint="0,0">
  23. <GradientStop Color="#FFECF4FC" Offset="0.0"/>
  24. <GradientStop Color="#FFDCECFC" Offset="1.0"/>
  25. </LinearGradientBrush>
  26. <SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA"/>
  27. <SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000"/>
  28. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="#FFFFFFFF"/>
  29. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA"/>
  30. <LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
  31. <GradientStop Color="#FFEBF4FC" Offset="0.0"/>
  32. <GradientStop Color="#FFDCECFC" Offset="1.0"/>
  33. </LinearGradientBrush>
  34. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="#FF7EB4EA"/>
  35. <LinearGradientBrush x:Key="ComboBox.Pressed.Background" EndPoint="0,1" StartPoint="0,0">
  36. <GradientStop Color="#FFDAECFC" Offset="0.0"/>
  37. <GradientStop Color="#FFC4E0FC" Offset="1.0"/>
  38. </LinearGradientBrush>
  39. <SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF569DE5"/>
  40. <SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000"/>
  41. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF"/>
  42. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="#FF569DE5"/>
  43. <LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
  44. <GradientStop Color="#FFDAEBFC" Offset="0.0"/>
  45. <GradientStop Color="#FFC4E0FC" Offset="1.0"/>
  46. </LinearGradientBrush>
  47. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5"/>
  48. <SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0"/>
  49. <SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9"/>
  50. <SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF"/>
  51. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF"/>
  52. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF"/>
  53. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/>
  54. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/>
  55. <Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  56. <Setter Property="OverridesDefaultStyle" Value="true"/>
  57. <Setter Property="IsTabStop" Value="false"/>
  58. <Setter Property="Focusable" Value="false"/>
  59. <Setter Property="ClickMode" Value="Press"/>
  60. <Setter Property="Template">
  61. <Setter.Value>
  62. <ControlTemplate TargetType="{x:Type ToggleButton}">
  63. <Border x:Name="templateRoot" CornerRadius="10" Background="White" Opacity="0.5" BorderBrush="Black" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
  64. <Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0,0,10,0" SnapsToDevicePixels="true" Width="30">
  65. <Image Source="/Resources/arrow_down.png"/>
  66. </Border>
  67. </Border>
  68. <ControlTemplate.Triggers>
  69. <MultiDataTrigger>
  70. <MultiDataTrigger.Conditions>
  71. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  72. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=Self}}" Value="false"/>
  73. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Mode=Self}}" Value="false"/>
  74. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Mode=Self}}" Value="true"/>
  75. </MultiDataTrigger.Conditions>
  76. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Background}"/>
  77. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Border}"/>
  78. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Background}"/>
  79. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Border}"/>
  80. </MultiDataTrigger>
  81. <MultiDataTrigger>
  82. <MultiDataTrigger.Conditions>
  83. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=Self}}" Value="true"/>
  84. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  85. </MultiDataTrigger.Conditions>
  86. <Setter Property="Background" TargetName="templateRoot" Value="white"/>
  87. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Border}"/>
  88. </MultiDataTrigger>
  89. <MultiDataTrigger>
  90. <MultiDataTrigger.Conditions>
  91. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=Self}}" Value="true"/>
  92. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  93. </MultiDataTrigger.Conditions>
  94. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Background}"/>
  95. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Border}"/>
  96. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}"/>
  97. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}"/>
  98. </MultiDataTrigger>
  99. <MultiDataTrigger>
  100. <MultiDataTrigger.Conditions>
  101. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Mode=Self}}" Value="true"/>
  102. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  103. </MultiDataTrigger.Conditions>
  104. <Setter Property="Background" TargetName="templateRoot" Value="white"/>
  105. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Border}"/>
  106. </MultiDataTrigger>
  107. <MultiDataTrigger>
  108. <MultiDataTrigger.Conditions>
  109. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Mode=Self}}" Value="true"/>
  110. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  111. </MultiDataTrigger.Conditions>
  112. <Setter Property="Background" TargetName="templateRoot" Value="white"/>
  113. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Border}"/>
  114. <Setter Property="Background" TargetName="splitBorder" Value="white"/>
  115. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}"/>
  116. </MultiDataTrigger>
  117. <MultiDataTrigger>
  118. <MultiDataTrigger.Conditions>
  119. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Mode=Self}}" Value="false"/>
  120. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  121. </MultiDataTrigger.Conditions>
  122. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Background}"/>
  123. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Border}"/>
  124. </MultiDataTrigger>
  125. <MultiDataTrigger>
  126. <MultiDataTrigger.Conditions>
  127. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Mode=Self}}" Value="false"/>
  128. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  129. </MultiDataTrigger.Conditions>
  130. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Background}"/>
  131. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Border}"/>
  132. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}"/>
  133. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}"/>
  134. </MultiDataTrigger>
  135. </ControlTemplate.Triggers>
  136. </ControlTemplate>
  137. </Setter.Value>
  138. </Setter>
  139. </Style>
  140. <ControlTemplate x:Key="ComboBoxTemplate1" TargetType="{x:Type ComboBox}">
  141. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  142. <Grid.ColumnDefinitions>
  143. <ColumnDefinition Width="*"/>
  144. <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="50"/>
  145. </Grid.ColumnDefinitions>
  146. <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" Margin="1" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  147. <theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  148. <Border x:Name="dropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
  149. <ScrollViewer x:Name="DropDownScrollViewer">
  150. <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
  151. <Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  152. <Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
  153. </Canvas>
  154. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  155. </Grid>
  156. </ScrollViewer>
  157. </Border>
  158. </theme:SystemDropShadowChrome>
  159. </Popup>
  160. <ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
  161. <ContentPresenter x:Name="contentPresenter" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  162. </Grid>
  163. <ControlTemplate.Triggers>
  164. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  165. <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
  166. <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
  167. </Trigger>
  168. <Trigger Property="HasItems" Value="false">
  169. <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
  170. </Trigger>
  171. <MultiTrigger>
  172. <MultiTrigger.Conditions>
  173. <Condition Property="IsGrouping" Value="true"/>
  174. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
  175. </MultiTrigger.Conditions>
  176. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  177. </MultiTrigger>
  178. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  179. <Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  180. <Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  181. </Trigger>
  182. </ControlTemplate.Triggers>
  183. </ControlTemplate>
  184. <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/>
  185. <SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5"/>
  186. <ControlTemplate x:Key="TextBoxTemplate1" TargetType="{x:Type TextBoxBase}">
  187. <Border x:Name="border" CornerRadius="10" BorderBrush="Black" BorderThickness="1" SnapsToDevicePixels="True">
  188. <Border.Background>
  189. <SolidColorBrush Color="White" Opacity="0.5"/>
  190. </Border.Background>
  191. <ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
  192. </Border>
  193. <ControlTemplate.Triggers>
  194. </ControlTemplate.Triggers>
  195. </ControlTemplate>
  196. <SolidColorBrush x:Key="brushWatermarkBackground" Color="White" />
  197. <SolidColorBrush x:Key="brushWatermarkForeground" Color="LightSteelBlue" />
  198. <SolidColorBrush x:Key="brushWatermarkBorder" Color="Indigo" />
  199. <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
  200. <Style x:Key="EntryFieldStyle" TargetType="Grid" >
  201. <Setter Property="HorizontalAlignment" Value="Stretch" />
  202. <Setter Property="VerticalAlignment" Value="Center" />
  203. </Style>
  204. </Page.Resources>
  205. <Grid Background="#00A08A">
  206. <Grid.RowDefinitions>
  207. <RowDefinition Height="160"/>
  208. <RowDefinition/>
  209. </Grid.RowDefinitions>
  210. <Grid Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Center">
  211. <ComboBox SelectionChanged="ChangeCategory" FontSize="30" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" SelectedIndex="0" Margin="20,0,0,0" Template="{DynamicResource ComboBoxTemplate1}" Name="CategoryFilter" HorizontalAlignment="Left" Height="70" Width="370"/>
  212. <TextBox TextChanged="SearchChanged" Name="SearchBar" ToolTip="Поиск" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="30" Template="{DynamicResource TextBoxTemplate1}" HorizontalAlignment="Center" Background="#0000" Height="70" Width="370" />
  213. <Button Click="GoToUserPage" Margin="0,0,20,0" Background="#FFA400" Template="{StaticResource ButtonTemplate1}" HorizontalAlignment="Right" Height="135" Width="110">
  214. <Button.Content>
  215. <Image Width="90" Height="110" Source="/Resources/Account.png"/>
  216. </Button.Content>
  217. </Button>
  218. </Grid>
  219. <ListView Margin="0,10,0,10" Name="TestList" Grid.Row="1" Background="#0000" BorderThickness="0">
  220. <ListView.ItemsPanel>
  221. <ItemsPanelTemplate>
  222. <StackPanel Width="1400"/>
  223. </ItemsPanelTemplate>
  224. </ListView.ItemsPanel>
  225. <ListView.ItemTemplate>
  226. <DataTemplate>
  227. <Border VerticalAlignment="Center" CornerRadius="10" BorderThickness="2" BorderBrush="Black" Height="370" Width="1400">
  228. <Border.Background>
  229. <SolidColorBrush Color="White" Opacity="0.5"/>
  230. </Border.Background>
  231. <Grid Width="1400">
  232. <Grid.ColumnDefinitions>
  233. <ColumnDefinition Width="*"/>
  234. <ColumnDefinition Width="2*"/>
  235. </Grid.ColumnDefinitions>
  236. <Image Margin="60,0,0,0" Grid.Column="0" HorizontalAlignment="Left" Uid="{Binding Test_id}" Width="260" Height="260" Loaded="Image_Loaded"/>
  237. <StackPanel Grid.Column="1" HorizontalAlignment="Center">
  238. <TextBlock Margin="0,35,0,0" Text="{Binding Test_name}" FontSize="40" HorizontalAlignment="Center"/>
  239. <TextBlock Margin="0,20,0,0" TextWrapping="Wrap" Text="{Binding Description}" FontSize="20" HorizontalAlignment="Center"/>
  240. <TextBlock Margin="0,20,0,0" Text="{Binding StringFormat=Количество вопросов: {0}, Path=Questions_count}" FontSize="18" HorizontalAlignment="Center"/>
  241. <Button Uid="{Binding Test_id}" Click="GoToTestPage" Margin="0,20,0,0" Content="Пройти тест" FontSize="30" Template="{DynamicResource ButtonTemplate1}" Width="540" Height="60" Background="#FFA400" BorderBrush="#0000"/>
  242. </StackPanel>
  243. </Grid>
  244. </Border>
  245. </DataTemplate>
  246. </ListView.ItemTemplate>
  247. </ListView>
  248. </Grid>
  249. </Page>