EditorMatchesMultiply.axaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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:conv="clr-namespace:EntranseTesting.Converter;assembly=EntranseTesting"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
  7. x:Class="EntranseTesting.EditorMatchesMultiply"
  8. x:DataType="vm:MainWindowViewModel"
  9. xmlns:vm="using:EntranseTesting.ViewModels">
  10. <UserControl.Resources>
  11. <conv:ItemCAFSConverter x:Key="ItemCAFSConverter"/>
  12. </UserControl.Resources>
  13. <StackPanel Orientation="Vertical" Spacing="10">
  14. <TextBlock Text="Элементы" VerticalAlignment="Center" Margin="0 10"/>
  15. <ItemsRepeater ItemsSource="{Binding EditorPages.TaskEditorPage.MatchesMultiplyElement}"
  16. HorizontalAlignment="Stretch"
  17. VerticalAlignment="Stretch">
  18. <ItemsRepeater.Layout>
  19. <StackLayout Spacing="10" Orientation="Vertical"/>
  20. </ItemsRepeater.Layout>
  21. <ItemsRepeater.ItemTemplate>
  22. <DataTemplate>
  23. <Border BorderBrush="LightCoral" BorderThickness="0 0 0 1">
  24. <StackPanel Orientation="Horizontal" Spacing="10" HorizontalAlignment="Stretch"
  25. Name="ElementText">
  26. <Button Content="x"
  27. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.DeleteItem}"
  28. CommandParameter="{Binding}"
  29. IsVisible="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.NoEditing}"
  30. VerticalAlignment="Center" HorizontalAlignment="Center"/>
  31. <TextBox Width="350" Height="80"
  32. Margin="10 0"
  33. Text="{Binding Text}"
  34. VerticalContentAlignment="Top"/>
  35. <StackPanel Orientation="Vertical">
  36. <ItemsRepeater ItemsSource="{Binding ElementEditor}">
  37. <ItemsRepeater.Layout>
  38. <StackLayout Spacing="5" Orientation="Vertical"/>
  39. </ItemsRepeater.Layout>
  40. <ItemsRepeater.ItemTemplate>
  41. <DataTemplate>
  42. <StackPanel Orientation="Horizontal" Spacing="10"
  43. Name="ElementChoosing">
  44. <Button Content="x"
  45. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.DeleteItemCAFS}"
  46. CommandParameter="{Binding}"
  47. IsVisible="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.NoEditing}"
  48. VerticalAlignment="Center">
  49. <Button.CommandParameter>
  50. <MultiBinding Converter="{StaticResource ItemCAFSConverter}">
  51. <Binding ElementName="ElementText" Path="DataContext"/>
  52. <Binding ElementName="ElementChoosing" Path="DataContext" />
  53. </MultiBinding>
  54. </Button.CommandParameter>
  55. </Button>
  56. <CheckBox IsChecked="{Binding Correctly}"
  57. VerticalAlignment="Center"/>
  58. <TextBox Text="{Binding Name}"
  59. Width="350" Height="80"/>
  60. </StackPanel>
  61. </DataTemplate>
  62. </ItemsRepeater.ItemTemplate>
  63. </ItemsRepeater>
  64. <Button Content="Добавить элемент выбора" Margin="10 0"
  65. IsVisible="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.NoEditing}"
  66. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.AddItemCAFS}"
  67. CommandParameter="{Binding}"
  68. VerticalAlignment="Center" HorizontalAlignment="Center"/>
  69. </StackPanel>
  70. </StackPanel>
  71. </Border>
  72. </DataTemplate>
  73. </ItemsRepeater.ItemTemplate>
  74. </ItemsRepeater>
  75. <Button Content="Добавить элемент"
  76. IsVisible="{Binding EditorPages.TaskEditorPage.NoEditing}"
  77. Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).EditorPages.TaskEditorPage.AddItem}"
  78. HorizontalAlignment="Center"/>
  79. </StackPanel>
  80. </UserControl>