|
| 1 | +<UserControl x:Class="LearnJsonEverything.LessonEditor.Controls.Editor" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:local="clr-namespace:LearnJsonEverything.LessonEditor.Controls" |
| 7 | + xmlns:services="clr-namespace:LearnJsonEverything.Services;assembly=LearnJsonEverything" |
| 8 | + mc:Ignorable="d" |
| 9 | + d:DesignHeight="450" d:DesignWidth="800" |
| 10 | + x:Name="Self"> |
| 11 | + <UserControl.Resources> |
| 12 | + <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}"> |
| 13 | + <Setter Property="Margin" Value="5"/> |
| 14 | + <Setter Property="Padding" Value="10,3"/> |
| 15 | + </Style> |
| 16 | + </UserControl.Resources> |
| 17 | + <Grid> |
| 18 | + <Grid.RowDefinitions> |
| 19 | + <RowDefinition/> |
| 20 | + <RowDefinition/> |
| 21 | + <RowDefinition Height="Auto"/> |
| 22 | + </Grid.RowDefinitions> |
| 23 | + <Grid.ColumnDefinitions> |
| 24 | + <ColumnDefinition Width="Auto"/> |
| 25 | + <ColumnDefinition Width="2*"/> |
| 26 | + <ColumnDefinition Width="3*"/> |
| 27 | + </Grid.ColumnDefinitions> |
| 28 | + <Grid Margin="5,5,5,0"> |
| 29 | + <Grid.RowDefinitions> |
| 30 | + <RowDefinition/> |
| 31 | + <RowDefinition Height="Auto"/> |
| 32 | + </Grid.RowDefinitions> |
| 33 | + <ListBox MinWidth="100" ItemsSource="{Binding Lessons, ElementName=Self}" |
| 34 | + SelectedItem="{Binding SelectedLesson, ElementName=Self}"> |
| 35 | + <ListBox.ItemTemplate> |
| 36 | + <DataTemplate DataType="{x:Type services:LessonData}"> |
| 37 | + <TextBlock Text="{Binding Title}"/> |
| 38 | + </DataTemplate> |
| 39 | + </ListBox.ItemTemplate> |
| 40 | + </ListBox> |
| 41 | + <Grid Grid.Row="1" Margin="-5,5,-5,0"> |
| 42 | + <Grid.ColumnDefinitions> |
| 43 | + <ColumnDefinition Width="Auto"/> |
| 44 | + <ColumnDefinition/> |
| 45 | + <ColumnDefinition/> |
| 46 | + <ColumnDefinition Width="Auto"/> |
| 47 | + </Grid.ColumnDefinitions> |
| 48 | + <Button Content="🡅" Click="MoveLessonUp"/> |
| 49 | + <Button Content="Add" Click="AddLesson" Grid.Column="1"/> |
| 50 | + <Button Content="Delete" Click="RemoveLesson" Grid.Column="2"/> |
| 51 | + <Button Content="🡇" Click="MoveLessonDown" Grid.Column="3"/> |
| 52 | + </Grid> |
| 53 | + </Grid> |
| 54 | + <Grid Grid.Column="1" Margin="5"> |
| 55 | + <Grid.RowDefinitions> |
| 56 | + <RowDefinition Height="Auto"/> |
| 57 | + <RowDefinition/> |
| 58 | + <RowDefinition Height="Auto"/> |
| 59 | + <RowDefinition/> |
| 60 | + </Grid.RowDefinitions> |
| 61 | + <local:TextInput Label="Title" TextContent="{Binding LessonTitle, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> |
| 62 | + <local:TextInput Grid.Row="1" Label="Background" TextContent="{Binding LessonBackground, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> |
| 63 | + <local:TextInput Grid.Row="2" Label="Docs Path (from root on docs.json-everything.net)" TextContent="{Binding DocsPath, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> |
| 64 | + <local:TextInput Grid.Row="3" Label="Instructions" TextContent="{Binding Instructions, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> |
| 65 | + </Grid> |
| 66 | + <Grid Grid.Column="2" Grid.RowSpan="2" Margin="5"> |
| 67 | + <Grid.RowDefinitions> |
| 68 | + <RowDefinition/> |
| 69 | + <RowDefinition/> |
| 70 | + </Grid.RowDefinitions> |
| 71 | + <local:CodeInput Label="Initial Code" Margin="0,0,5,5" |
| 72 | + CodeContent="{Binding InitialCode, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> |
| 73 | + <local:CodeInput Grid.Row="1" Label="Solution" Margin="0,5,5,0" |
| 74 | + CodeContent="{Binding Solution, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> |
| 75 | + <Button Grid.Row="1" Content="Copy from above" Click="CopyInitialToSolution" |
| 76 | + HorizontalAlignment="Right" VerticalAlignment="Top" |
| 77 | + Padding="10,0"/> |
| 78 | + </Grid> |
| 79 | + <Grid Grid.Row="1" Margin="5,5,5,0"> |
| 80 | + <Grid.RowDefinitions> |
| 81 | + <RowDefinition Height="Auto"/> |
| 82 | + <RowDefinition/> |
| 83 | + <RowDefinition Height="Auto"/> |
| 84 | + </Grid.RowDefinitions> |
| 85 | + <Label Content="Tests"/> |
| 86 | + <ListBox Grid.Row="1" ItemsSource="{Binding Tests, ElementName=Self}" SelectedItem="{Binding SelectedTest, ElementName=Self}"> |
| 87 | + <ListBox.ItemTemplate> |
| 88 | + <DataTemplate DataType="{x:Type local:TestModel}"> |
| 89 | + <TextBlock Text="{Binding Condensed}"/> |
| 90 | + </DataTemplate> |
| 91 | + </ListBox.ItemTemplate> |
| 92 | + </ListBox> |
| 93 | + <Grid Grid.Row="2" Margin="-5,5,-5,0"> |
| 94 | + <Grid.ColumnDefinitions> |
| 95 | + <ColumnDefinition Width="Auto"/> |
| 96 | + <ColumnDefinition/> |
| 97 | + <ColumnDefinition/> |
| 98 | + <ColumnDefinition Width="Auto"/> |
| 99 | + </Grid.ColumnDefinitions> |
| 100 | + <Button Content="🡅" Click="MoveTestUp"/> |
| 101 | + <Button Content="Add" Click="AddTest" Grid.Column="1"/> |
| 102 | + <Button Content="Delete" Click="RemoveTest" Grid.Column="2"/> |
| 103 | + <Button Content="🡇" Click="MoveTestDown" Grid.Column="3"/> |
| 104 | + </Grid> |
| 105 | + </Grid> |
| 106 | + <local:CodeInput Grid.Column="1" Grid.Row="1" Label="Test Data" Margin="5" |
| 107 | + CodeContent="{Binding SelectedTest.Formatted, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> |
| 108 | + <StackPanel Grid.Row="2" Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,5,5"> |
| 109 | + <Button Content="Validate" Click="ValidateSolution"/> |
| 110 | + <Button Content="Save" Click="SaveChanges" IsEnabled="{Binding CanSave, ElementName=Self}"/> |
| 111 | + <Button Content="Reset" Click="ResetContent"/> |
| 112 | + </StackPanel> |
| 113 | + </Grid> |
| 114 | +</UserControl> |
0 commit comments