TestPage.axaml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
  6. x:Class="EntranseTesting.TestPage"
  7. xmlns:vm="using:EntranseTesting.ViewModels"
  8. x:DataType="vm:MainWindowViewModel">
  9. <Grid RowDefinitions="Auto,Auto,Auto,*,Auto"
  10. ColumnDefinitions="*,*"
  11. Margin="15 10"
  12. HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
  13. <!-- Имя пользователя -->
  14. <TextBlock Text="{Binding TestMain.NameUser, TargetNullValue='Не авторизован', StringFormat='Пользователь: {0}'}"
  15. Grid.Row="0" Grid.Column="0" Margin="0 5 10 15"
  16. HorizontalAlignment="Left" VerticalAlignment="Center"/>
  17. <!-- Навигация и прогресс теста-->
  18. <StackPanel Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Stretch">
  19. <Grid ColumnDefinitions="Auto, *,Auto">
  20. <Button Classes="ProgressNav" MinWidth="25"
  21. Grid.Column="0"
  22. HorizontalContentAlignment="Center"
  23. VerticalContentAlignment="Center"
  24. Content="&lt;"
  25. Command="{Binding TestMain.TestPages.Back}"/>
  26. <ScrollViewer HorizontalScrollBarVisibility="Auto"
  27. VerticalScrollBarVisibility="Disabled"
  28. Grid.Column="1"
  29. Margin="5 0">
  30. <ItemsRepeater ItemsSource="{Binding TestMain.TestPages.TakeProgressButtons}"
  31. VerticalAlignment="Stretch" HorizontalAlignment="Center"
  32. Margin="0 15">
  33. <ItemsRepeater.Layout>
  34. <StackLayout Spacing="5" Orientation="Horizontal"/>
  35. </ItemsRepeater.Layout>
  36. <ItemsRepeater.ItemTemplate>
  37. <DataTemplate>
  38. <Button Content="{Binding Num}"
  39. Classes="Progress"
  40. Classes.active="{Binding Active}" Classes.check="{Binding Check}"
  41. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).TestMain.ClickToQuestion}"
  42. CommandParameter="{Binding Num}"
  43. HorizontalContentAlignment="Center"
  44. VerticalContentAlignment="Center">
  45. <Button.Styles>
  46. <Style Selector=":is(Button).check">
  47. <Setter Property="Background" Value="LightGreen"/>
  48. </Style>
  49. <Style Selector=":is(Button).active">
  50. <Setter Property="Background" Value="#696BFF"/>
  51. </Style>
  52. </Button.Styles>
  53. </Button>
  54. </DataTemplate>
  55. </ItemsRepeater.ItemTemplate>
  56. </ItemsRepeater>
  57. </ScrollViewer>
  58. <Button Classes="ProgressNav" MinWidth="25"
  59. Grid.Column="2"
  60. HorizontalContentAlignment="Center"
  61. VerticalContentAlignment="Center"
  62. Content="&gt;"
  63. Command="{Binding TestMain.TestPages.Next}"/>
  64. </Grid>
  65. <ProgressBar Minimum="0" Maximum="{Binding TestMain.TestPages.CountQuestion}"
  66. Value="{Binding TestMain.TestPages.NumQuestion}"
  67. Margin="0 5"
  68. ShowProgressText="True" ProgressTextFormat="{Binding TestMain.TestPages.ProgressText}"/>
  69. </StackPanel>
  70. <!-- Номер вопроса -->
  71. <TextBlock Text="{Binding TestMain.TestPages.NumQuestion, StringFormat='Вопрос {0}'}"
  72. Margin="10 5" Grid.Column="0" Grid.Row="2"
  73. HorizontalAlignment="Left"/>
  74. <ContentControl Content="{Binding TestMain.TestPages.TestUC}"
  75. Grid.Row="3" Grid.ColumnSpan="2" Margin="0 5"
  76. HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
  77. <Button Content="{Binding TestMain.TestPages.ButtonValue}"
  78. Command="{Binding NextQuestion}"
  79. Grid.Row="4" Grid.ColumnSpan="2"
  80. HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
  81. HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
  82. <!-- Подсказки -->
  83. <Expander VerticalAlignment="Top" Grid.Column="1" Grid.Row="0" Grid.RowSpan="5"
  84. HorizontalAlignment="Right" IsVisible="{Binding TestMain.TestPages.SettingTest.HintVisibility}"
  85. MaxWidth="{Binding $parent.Bounds.Width}">
  86. <Expander.Header>
  87. <StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Center"
  88. HorizontalAlignment="Right">
  89. <PathIcon Data="{StaticResource LightbulbCircleRegular}"/>
  90. <TextBlock Text="Подсказки"/>
  91. </StackPanel>
  92. </Expander.Header>
  93. <Expander.Content>
  94. <Grid >
  95. <TextBlock Text="Подсказки для данного задания не предусмотрены"
  96. IsVisible="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).TestMain.TestPages.NoVisibleHint}"/>
  97. <StackPanel Orientation="Vertical" Spacing="10"
  98. IsVisible="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).TestMain.TestPages.VisibleHint}">
  99. <!-- Информация о количестве подсказок -->
  100. <TextBlock Text="{Binding TestMain.TestPages.HintCountLine}"
  101. HorizontalAlignment="Right" VerticalAlignment="Center"/>
  102. <!-- Подсказки -->
  103. <ScrollViewer MaxHeight="450">
  104. <ItemsRepeater ItemsSource="{Binding TestMain.TestPages.Hints}"
  105. HorizontalAlignment="Stretch"
  106. VerticalAlignment="Stretch"
  107. Margin="0 0 20 0">
  108. <ItemsRepeater.Layout>
  109. <StackLayout Orientation="Vertical"/>
  110. </ItemsRepeater.Layout>
  111. <ItemsRepeater.ItemTemplate>
  112. <DataTemplate>
  113. <Border BorderBrush="#696BFF" BorderThickness="0 0 0 1" Padding="0 5">
  114. <Grid RowDefinitions="Auto,Auto">
  115. <StackPanel Orientation="Vertical" Spacing="10" Grid.Row="1"
  116. IsVisible="{Binding HintPurchased}">
  117. <TextBlock Text="{Binding IdHintNavigation.Text}"
  118. VerticalAlignment="Center"/>
  119. <ItemsRepeater ItemsSource="{Binding IdHintNavigation.HintImages}"
  120. HorizontalAlignment="Stretch"
  121. VerticalAlignment="Stretch">
  122. <ItemsRepeater.Layout>
  123. <WrapLayout HorizontalSpacing="10" VerticalSpacing="5"/>
  124. </ItemsRepeater.Layout>
  125. <ItemsRepeater.ItemTemplate>
  126. <DataTemplate>
  127. <Image Source="{Binding hImage}" Classes="Test"/>
  128. </DataTemplate>
  129. </ItemsRepeater.ItemTemplate>
  130. </ItemsRepeater>
  131. </StackPanel>
  132. <Grid ColumnDefinitions="*,*"
  133. IsVisible="{Binding NoHintPurchased}">
  134. <TextBlock Text="Цена подсказки "/>
  135. <Button Grid.Column="1"
  136. Content="{Binding CostLine}"
  137. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).TestMain.TestPages.BuyAHint}"
  138. CommandParameter="{Binding Id}"
  139. HorizontalAlignment="Right"/>
  140. </Grid>
  141. </Grid>
  142. </Border>
  143. </DataTemplate>
  144. </ItemsRepeater.ItemTemplate>
  145. </ItemsRepeater>
  146. </ScrollViewer>
  147. </StackPanel>
  148. </Grid>
  149. </Expander.Content>
  150. </Expander>
  151. </Grid>
  152. </UserControl>