TaskMain.axaml 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.TaskMain"
  7. x:DataType="vm:MainWindowViewModel"
  8. xmlns:vm="using:EntranseTesting.ViewModels">
  9. <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
  10. <Grid Margin="15 10"
  11. RowDefinitions="Auto,*">
  12. <!-- Блок фильтрации, поиска, сортировки -->
  13. <WrapPanel Orientation="Horizontal">
  14. <!-- // Поиск //-->
  15. <StackPanel Orientation="Vertical" Margin="5">
  16. <TextBlock Text="Искать по вопросу"
  17. VerticalAlignment="Center"/>
  18. <TextBox Text="{Binding EditorPages.TaskMainPage.SearchLine}"
  19. TextBlock.TextWrapping="NoWrap"
  20. Width="250"/>
  21. </StackPanel>
  22. <!-- // Фильтрация //-->
  23. <StackPanel Orientation="Vertical" Margin="5">
  24. <TextBlock Text="Фильтровать по типу задания"
  25. VerticalAlignment="Center"/>
  26. <ComboBox ItemsSource="{Binding EditorPages.TaskMainPage.CategoryList}"
  27. SelectedItem="{Binding EditorPages.TaskMainPage.SelectedCategory}"
  28. Width="250" WrapSelection="False"
  29. TextBlock.TextWrapping="NoWrap"/>
  30. </StackPanel>
  31. <!-- // Сортировка //-->
  32. <StackPanel Orientation="Vertical" Margin="5">
  33. <TextBlock Text="Сортировать"
  34. VerticalAlignment="Center"/>
  35. <ComboBox ItemsSource="{Binding EditorPages.TaskMainPage.SortList}"
  36. SelectedItem="{Binding EditorPages.TaskMainPage.SelectedSort}"
  37. Width="250" WrapSelection="False"
  38. TextBlock.TextWrapping="NoWrap"/>
  39. </StackPanel>
  40. <!-- // Те которые включаются в тест //-->
  41. <CheckBox Content="Вопросы, включаемые в тест"
  42. VerticalAlignment="Bottom"
  43. Width="300" Margin="5"
  44. IsChecked="{Binding EditorPages.TaskMainPage.SelectedInTest}"/>
  45. <!-- // Кнопка Добавления вопроса //-->
  46. <Button Command="{Binding AddQuestion}"
  47. VerticalAlignment="Bottom" Margin="5"
  48. Content="Добавить вопрос"/>
  49. </WrapPanel>
  50. <!-- Вопросы -->
  51. <ItemsRepeater Grid.Row="1" ItemsSource="{Binding EditorPages.TaskMainPage.Questions}"
  52. VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
  53. <ItemsRepeater.Layout>
  54. <StackLayout Spacing="10" Orientation="Vertical"/>
  55. </ItemsRepeater.Layout>
  56. <ItemsRepeater.ItemTemplate>
  57. <DataTemplate>
  58. <Border BorderBrush="LightCoral" BorderThickness="0 0 0 2"
  59. HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
  60. Margin="10 2">
  61. <StackPanel Orientation="Vertical">
  62. <Grid ColumnDefinitions="*,*">
  63. <!-- Кол-во раз в тесте -->
  64. <ContentControl Content="{Binding AllCountInTest}"
  65. HorizontalAlignment="Stretch"
  66. VerticalAlignment="Top"/>
  67. <Button Grid.Column="1"
  68. HorizontalAlignment="Right" Classes="icon"
  69. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditQuestion}" CommandParameter="{Binding Id}"
  70. Tag="{StaticResource DraftsRegular}"
  71. Content="Редактировать"/>
  72. </Grid>
  73. <!-- Задание -->
  74. <ContentControl Content="{Binding tName}"
  75. HorizontalAlignment="Stretch"/>
  76. <!-- Ответ -->
  77. <ContentControl Content="{Binding Answer}"
  78. HorizontalAlignment="Stretch"/>
  79. <!-- Количество + и - ответов -->
  80. <ContentControl Content="{Binding CountInTest}"
  81. HorizontalAlignment="Stretch"/>
  82. <Button Content="Удалить вопрос" Margin="5"
  83. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskMainPage.DeleteQuestion}"
  84. CommandParameter="{Binding Id}"
  85. HorizontalAlignment="Right"
  86. IsVisible="{Binding IsVisibleDelete}"/>
  87. </StackPanel>
  88. </Border>
  89. </DataTemplate>
  90. </ItemsRepeater.ItemTemplate>
  91. </ItemsRepeater>
  92. </Grid>
  93. </ScrollViewer>
  94. </UserControl>