AddTeacherView.axaml 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:vm="using:Teachers.ViewModels"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
  7. x:Class="Teachers.AddTeacherView"
  8. x:DataType="vm:AddTeacherViewModel"
  9. xmlns:conv="using:Teachers.Converters">
  10. <UserControl.Resources>
  11. <conv:DateConverter x:Key="myConv"/>
  12. </UserControl.Resources>
  13. <Grid>
  14. <ScrollViewer>
  15. <StackPanel>
  16. <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
  17. <Button Classes="bAddTeacher" Command="{Binding ToTeachersView}">Назад</Button>
  18. <Button Classes="bAddTeacher" Command="{Binding AddTeacher}" Content="{Binding ButtonText}"></Button>
  19. <Button Classes="bAddTeacher" Command="{Binding ShowAddCourse}">Добавить курс</Button>
  20. </StackPanel>
  21. <TextBox Watermark="Фамилия" Classes="tbAddTeacher" Text="{Binding NewTeacher.Surname}"></TextBox>
  22. <TextBox Watermark="Имя" Classes="tbAddTeacher" Text="{Binding NewTeacher.Name}"></TextBox>
  23. <TextBox Watermark="Отчество" Classes="tbAddTeacher" Text="{Binding NewTeacher.Patronymic}"></TextBox>
  24. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  25. <ComboBox Classes="cbAddTeacherGender" PlaceholderText="Выберите пол" ItemsSource="{Binding GendersL}" SelectedItem="{Binding NewTeacher.GenderNavigation}">
  26. <ComboBox.ItemTemplate>
  27. <DataTemplate>
  28. <TextBlock Text="{Binding Gender1}"></TextBlock>
  29. </DataTemplate>
  30. </ComboBox.ItemTemplate>
  31. </ComboBox>
  32. <DatePicker Classes="dpAddTeacher" SelectedDate="{Binding NewTeacher.Birthday, Converter={StaticResource myConv}}"></DatePicker>
  33. </StackPanel>
  34. <TextBox Watermark="Опыт (месяцев)" Classes="tbAddTeacher" Text="{Binding NewTeacher.Experience}"></TextBox>
  35. <TextBox Watermark="Почта" Classes="tbAddTeacher" Text="{Binding NewTeacher.Email}"></TextBox>
  36. <TextBox Watermark="Телефон" Classes="tbAddTeacher" Text="{Binding NewTeacher.Phone}"></TextBox>
  37. <Grid ColumnDefinitions="*, *">
  38. <StackPanel HorizontalAlignment="Left" Grid.Column="0">
  39. <ComboBox Classes="cbAddTeacher" ItemsSource="{Binding CoursesL}" SelectedValue="{Binding SelectedCourse}">
  40. <ComboBox.ItemTemplate>
  41. <DataTemplate>
  42. <TextBlock Text="{Binding Name}"></TextBlock>
  43. </DataTemplate>
  44. </ComboBox.ItemTemplate>
  45. </ComboBox>
  46. <ListBox Classes="lbAddTeacher" ItemsSource="{Binding CoursesTable}">
  47. <ListBox.ItemTemplate>
  48. <DataTemplate>
  49. <Border Classes="lbiAddTeacher">
  50. <Grid Classes="lbiAddTeacher" ColumnDefinitions="*, *">
  51. <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Grid.Column="0" Text="{Binding IdCourseNavigation.Name}"></TextBlock>
  52. <Button Grid.Column="1" Classes="bDelCourse" Command="{Binding $parent[UserControl].((vm:AddTeacherViewModel)DataContext).DeleteCourse}" CommandParameter="{Binding}">x</Button>
  53. </Grid>
  54. </Border>
  55. </DataTemplate>
  56. </ListBox.ItemTemplate>
  57. </ListBox>
  58. </StackPanel>
  59. <StackPanel HorizontalAlignment="Left" Grid.Column="1">
  60. <ComboBox Classes="cbAddTeacher" ItemsSource="{Binding SubjectsL}" SelectedValue="{Binding SelectedSubject}">
  61. <ComboBox.ItemTemplate>
  62. <DataTemplate>
  63. <TextBlock Text="{Binding Name}"></TextBlock>
  64. </DataTemplate>
  65. </ComboBox.ItemTemplate>
  66. </ComboBox>
  67. <ListBox Classes="lbAddTeacher" ItemsSource="{Binding SubjectsTable}">
  68. <ListBox.ItemTemplate>
  69. <DataTemplate>
  70. <Border Classes="lbiAddTeacher">
  71. <Grid ColumnDefinitions="*, *">
  72. <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Grid.Column="0" Text="{Binding IdSubjectNavigation.Name}"></TextBlock>
  73. <Button Grid.Column="1" Classes="bDelCourse" Command="{Binding $parent[UserControl].((vm:AddTeacherViewModel)DataContext).DeleteSubject}" CommandParameter="{Binding}">x</Button>
  74. </Grid>
  75. </Border>
  76. </DataTemplate>
  77. </ListBox.ItemTemplate>
  78. </ListBox>
  79. </StackPanel>
  80. </Grid>
  81. </StackPanel>
  82. </ScrollViewer>
  83. </Grid>
  84. </UserControl>