EditAndAddModule.axaml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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="990" d:DesignHeight="1000"
  6. x:Class="AvaloniaApplication4.Views.ActionPages.EditAndAddModule"
  7. xmlns:vm="using:AvaloniaApplication4.ViewModels"
  8. x:DataType="vm:EditAndAddModuleViewModel"
  9. Background="White"
  10. Padding="80">
  11. <ScrollViewer>
  12. <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0 20 0 0">
  13. <TextBlock Margin="0 0 0 39" Text="Модули" Classes="titleStyle" FontWeight="Bold"/>
  14. <TextBox Text="{Binding Module.CodeModule}" Margin="0 0 0 22" Watermark="Код модуля"/>
  15. <TextBox Text="{Binding Module.Name}" Margin="0 0 0 22" Watermark="Наименование модуля"/>
  16. <TextBlock Text="Предметы модуля" Classes="litleText" FontWeight="Bold" FontSize="24" Margin="0 0 0 24"/>
  17. <Button Command="{Binding $parent[UserControl].((vm:EditAndAddModuleViewModel)DataContext).AddNewSubject}" Content="Добавить предмет" HorizontalAlignment="Stretch" Margin="0 0 0 24"/>
  18. <ListBox ItemsSource="{Binding MdkWithModulesBinding}" Margin="0 0 0 20">
  19. <ListBox.ItemTemplate>
  20. <DataTemplate>
  21. <Grid>
  22. <Grid.ColumnDefinitions>
  23. <ColumnDefinition Width="3*"/>
  24. <ColumnDefinition Width="1*"/>
  25. </Grid.ColumnDefinitions>
  26. <ComboBox ItemsSource="{Binding AllMDK}" SelectedItem="{Binding CurrentMDK, Mode=TwoWay}" Grid.Column="0" FontSize="16" HorizontalAlignment="Stretch" Margin="0 0 10 0">
  27. <ComboBox.ItemTemplate>
  28. <DataTemplate>
  29. <TextBlock Text="{Binding NameSubject}"/>
  30. </DataTemplate>
  31. </ComboBox.ItemTemplate>
  32. </ComboBox>
  33. <Button Content="Удалить" Command="{Binding $parent[UserControl].((vm:EditAndAddModuleViewModel)DataContext).DeleteCurrentSubject}" CommandParameter="{Binding Id}" Grid.Column="1" HorizontalAlignment="Stretch" Margin="10 0 0 0"/>
  34. </Grid>
  35. </DataTemplate>
  36. </ListBox.ItemTemplate>
  37. </ListBox>
  38. <Grid Margin="0 0 0 30">
  39. <Grid.ColumnDefinitions>
  40. <ColumnDefinition Width="1*"/>
  41. <ColumnDefinition Width="1*"/>
  42. </Grid.ColumnDefinitions>
  43. <Button HorizontalAlignment="Stretch" Margin="5" Content="Сохранить модуль" Command="{Binding $parent[UserControl].((vm:EditAndAddModuleViewModel)DataContext).Save}" Grid.Column="0"/>
  44. <Button IsEnabled="{Binding IsNotNew}" HorizontalAlignment="Stretch" Command="{Binding $parent[UserControl].((vm:EditAndAddModuleViewModel)DataContext).Delete}" Margin="5" Content="Удалить модуль" Grid.Column="1"/>
  45. </Grid>
  46. <Button HorizontalAlignment="Stretch" Command="{Binding $parent[UserControl].((vm:EditAndAddModuleViewModel)DataContext).GoBack}" Content="Вернуться назад"/>
  47. </StackPanel>
  48. </ScrollViewer>
  49. </UserControl>