TaskEditor.axaml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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.TaskEditor"
  7. x:DataType="vm:MainWindowViewModel"
  8. xmlns:vm="using:EntranseTesting.ViewModels">
  9. <Grid RowDefinitions="Auto,*" Margin="10">
  10. <Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto"
  11. Margin="0 5"
  12. HorizontalAlignment="Stretch">
  13. <Button Content="Назад"
  14. Command="{Binding ExitFromEditor}"
  15. Grid.Column="0"/>
  16. <TextBlock Text="{Binding EditorPages.TaskEditorPage.Header}"
  17. HorizontalAlignment="Center"
  18. Grid.Column="1" Classes="Header"/>
  19. <Button Content="Сохранить"
  20. Command="{Binding EditorPages.TaskEditorPage.QSaveChanges}"
  21. Grid.Column="2"/>
  22. </Grid>
  23. <ScrollViewer Grid.Row="1"
  24. HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
  25. <StackPanel Orientation="Vertical" Spacing="10" HorizontalAlignment="Stretch">
  26. <!-- // Вопрос //-->
  27. <StackPanel Orientation="Vertical" Margin="0 0 0 15">
  28. <TextBlock Text="Вопрос" Classes="Header2"
  29. VerticalAlignment="Center"
  30. HorizontalAlignment="Center"/>
  31. <CheckBox Content="Включить в тест" IsChecked="{Binding EditorPages.TaskEditorPage.Q.InTest}" Margin="10 0"/>
  32. <WrapPanel Orientation="Horizontal">
  33. <StackPanel Spacing="10" Margin="10"
  34. Orientation="Vertical">
  35. <WrapPanel Orientation="Vertical">
  36. <TextBlock Text="Вид вопроса*"
  37. ToolTip.Tip="Данные утрачиваются в случае изменения типа вопроса"
  38. VerticalAlignment="Center"/>
  39. <ComboBox Width="450" IsEnabled="{Binding EditorPages.TaskEditorPage.NoEditing}"
  40. ItemsSource="{Binding EditorPages.TaskEditorPage.Category}"
  41. SelectedItem="{Binding EditorPages.TaskEditorPage.SelectedCategory}"/>
  42. </WrapPanel>
  43. <WrapPanel Orientation="Vertical">
  44. <TextBlock Text="Текст"
  45. VerticalAlignment="Center"/>
  46. <TextBox Text="{Binding EditorPages.TaskEditorPage.Q.Name}"
  47. AcceptsReturn="True"
  48. HorizontalContentAlignment="Stretch"
  49. HorizontalAlignment="Stretch"
  50. Width="450" Height="150"/>
  51. </WrapPanel>
  52. </StackPanel>
  53. <StackPanel Orientation="Vertical" Margin="10" Spacing="10"
  54. MinWidth="400" MaxWidth="600" HorizontalAlignment="Stretch">
  55. <Grid ColumnDefinitions="Auto,*,Auto">
  56. <TextBlock Text="Картинки"
  57. Grid.Column="0"/>
  58. <Button Content="Добавить фото"
  59. Command="{Binding LoadImageForQuestion}"
  60. Grid.Column="2"/>
  61. </Grid>
  62. <ItemsRepeater ItemsSource="{Binding EditorPages.TaskEditorPage.QImage}"
  63. HorizontalAlignment="Stretch"
  64. VerticalAlignment="Stretch">
  65. <ItemsRepeater.Layout>
  66. <WrapLayout HorizontalSpacing="10" VerticalSpacing="5" Orientation="Horizontal"/>
  67. </ItemsRepeater.Layout>
  68. <ItemsRepeater.ItemTemplate>
  69. <DataTemplate>
  70. <StackPanel Orientation="Vertical">
  71. <Button Tag="{StaticResource DeleteRegular}" Content="Удалить фото"
  72. HorizontalAlignment="Right"
  73. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.DeleteQuestionImage}"
  74. CommandParameter="{Binding Id}"/>
  75. <Image Source="{Binding qImage}"
  76. MaxHeight="150" MaxWidth="200"
  77. Stretch="Uniform"/>
  78. </StackPanel>
  79. </DataTemplate>
  80. </ItemsRepeater.ItemTemplate>
  81. </ItemsRepeater>
  82. </StackPanel>
  83. </WrapPanel>
  84. <ContentControl Content="{Binding EditorPages.TaskEditorPage.TaskUC}"
  85. HorizontalAlignment="Stretch"
  86. Margin="10 0"/>
  87. </StackPanel>
  88. <!-- // Подсказки //-->
  89. <StackPanel Margin="15 0 0 0">
  90. <TextBlock Text="Подсказки" Classes="Header2"
  91. VerticalAlignment="Center"
  92. HorizontalAlignment="Center"
  93. Grid.Row="0"/>
  94. <ItemsRepeater ItemsSource="{Binding EditorPages.TaskEditorPage.QHint}"
  95. HorizontalAlignment="Center"
  96. VerticalAlignment="Stretch">
  97. <ItemsRepeater.Layout>
  98. <StackLayout Orientation="Vertical"/>
  99. </ItemsRepeater.Layout>
  100. <ItemsRepeater.ItemTemplate>
  101. <DataTemplate>
  102. <Border BorderBrush="#696BFF" BorderThickness="0 0 0 1" Padding="0 5">
  103. <StackPanel Orientation="Vertical">
  104. <StackPanel Orientation="Horizontal">
  105. <StackPanel Spacing="10">
  106. <WrapPanel Orientation="Vertical">
  107. <TextBlock Text="Цена"
  108. VerticalAlignment="Center"/>
  109. <NumericUpDown Minimum="1" Maximum="5"
  110. Value="{Binding Cost}"
  111. Width="350"/>
  112. </WrapPanel>
  113. <WrapPanel Orientation="Vertical">
  114. <TextBlock Text="Текст"
  115. VerticalAlignment="Center"/>
  116. <TextBox Text="{Binding IdHintNavigation.Text}"
  117. AcceptsReturn="True"
  118. HorizontalContentAlignment="Stretch"
  119. HorizontalAlignment="Stretch"
  120. Width="350" Height="200"/>
  121. </WrapPanel>
  122. </StackPanel>
  123. <StackPanel Orientation="Vertical" Margin="10" Spacing="10"
  124. MaxWidth="450">
  125. <Grid ColumnDefinitions="Auto,*,Auto">
  126. <TextBlock Text="Картинки к подсказке"
  127. Grid.Column="0"/>
  128. <Button Content="Добавить фото"
  129. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).LoadImageForHint}"
  130. CommandParameter="{Binding IdHintNavigation.Id}"
  131. Grid.Column="2"/>
  132. </Grid>
  133. <ItemsRepeater ItemsSource="{Binding IdHintNavigation.HintImages}"
  134. HorizontalAlignment="Stretch"
  135. VerticalAlignment="Stretch">
  136. <ItemsRepeater.Layout>
  137. <WrapLayout HorizontalSpacing="10" VerticalSpacing="5"/>
  138. </ItemsRepeater.Layout>
  139. <ItemsRepeater.ItemTemplate>
  140. <DataTemplate>
  141. <StackPanel Orientation="Vertical">
  142. <Button Tag="{StaticResource DeleteRegular}" Content="Удалить фото"
  143. Classes="icon"
  144. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.DeleteHintImage}"
  145. CommandParameter="{Binding Id}"
  146. HorizontalAlignment="Right"/>
  147. <Image Source="{Binding hImage}"
  148. MaxHeight="150" MaxWidth="200"
  149. Stretch="Uniform"/>
  150. </StackPanel>
  151. </DataTemplate>
  152. </ItemsRepeater.ItemTemplate>
  153. </ItemsRepeater>
  154. </StackPanel>
  155. </StackPanel>
  156. <Button Content="Удалить подсказку"
  157. HorizontalAlignment="Right"
  158. Margin="5"
  159. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.DeleteHint}"
  160. CommandParameter="{Binding IdHint}"/>
  161. </StackPanel>
  162. </Border>
  163. </DataTemplate>
  164. </ItemsRepeater.ItemTemplate>
  165. </ItemsRepeater>
  166. <Button Content="Добавить подсказку"
  167. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.AddHint}"
  168. HorizontalAlignment="Stretch"
  169. HorizontalContentAlignment="Center"
  170. Grid.Row="2" Margin="10"/>
  171. </StackPanel>
  172. </StackPanel>
  173. </ScrollViewer>
  174. </Grid>
  175. </UserControl>