-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
57 lines (57 loc) · 3.28 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<Window x:Class="EvalUITest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:EvalUITest"
mc:Ignorable="d"
Title="Script Shell" Height="350" Width="525"
d:DataContext="{d:DesignInstance local:MainVM, IsDesignTimeCreatable=False}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.Resources>
<local:BooleanToStringConverter x:Key="ResultHeaderConverter" OnTrue="Result:" OnFalse="Error:"/>
</Grid.Resources>
<ListView ItemsSource="{Binding AllCommands}" SelectedItem="{Binding CurrentCommand}" Grid.Row="0" Grid.ColumnSpan="3">
<ListView.ItemTemplate>
<DataTemplate DataType="{x:Type local:CommandVM}">
<Border BorderBrush="LightGreen" Name="border" BorderThickness="2,0,0,0" Padding="4,2">
<TextBlock Text="{Binding Text}"/>
</Border>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsSuccessful}" Value="False">
<Setter TargetName="border" Property="BorderBrush" Value="Red"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Label Target="{Binding ElementName=CCBox}" Content="Command:" Grid.Row="1" Grid.Column="0"/>
<DockPanel Grid.Row="1" Grid.Column="2" IsEnabled="{Binding IsInteractive}">
<Button Command="{Binding Evaluate}" Content="Run!" DockPanel.Dock="Right" Width="75"/>
<TextBox Name="CCBox" VerticalContentAlignment="Center">
<TextBox.InputBindings>
<KeyBinding Command="{Binding Evaluate}" Key="Return"/>
<KeyBinding Command="{Binding GoUp}" Key="Up"/>
<KeyBinding Command="{Binding GoDown}" Key="Down"/>
</TextBox.InputBindings>
<i:Interaction.Behaviors>
<local:CaretEndBehavior Text="{Binding CurrentInput, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"/>
</i:Interaction.Behaviors>
</TextBox>
</DockPanel>
<Label Target="{Binding ElementName=ResultBox}" Content="{Binding LastCommand.IsSuccessful, Converter={StaticResource ResultHeaderConverter}}" Grid.Row="2" Grid.Column="0"/>
<TextBox Text="{Binding LastCommand.Result, Mode=OneWay}" IsEnabled="False" VerticalContentAlignment="Center" Grid.Row="2" Grid.Column="2" Name="ResultBox"/>
<Label Content="strut" Grid.Row="2" Grid.Column="1" Visibility="Hidden"/>
</Grid>
</Window>