<UserControl x:Class="MECF.Framework.Simulator.Core.Robots.TrayRobotView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:MECF.Framework.Simulator.Core.Aligners"
             xmlns:deviceControl="clr-namespace:MECF.Framework.UI.Core.DeviceControl;assembly=MECF.Framework.UI.Core"
             xmlns:commons="clr-namespace:MECF.Framework.Simulator.Core.Commons"
             Height="900"  Width="900">

    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="100"></RowDefinition>
            <RowDefinition Height="150"></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="400"></RowDefinition>
        </Grid.RowDefinitions>

        <commons:SocketTitleView Grid.Row="0"></commons:SocketTitleView>

        <Canvas  Grid.Row="1"  Width="900">
            <CheckBox Content="Error" IsChecked="{Binding IsError}" Canvas.Left="36" Canvas.Top="73"></CheckBox>
            <TextBlock Text="_ERR {Code}" Canvas.Left="204" Canvas.Top="52"></TextBlock>
            <TextBlock Text="Error Code:" Canvas.Left="99" Canvas.Top="72"></TextBlock>
            <!--<TextBox  Text="{Binding ResultValue, UpdateSourceTrigger=PropertyChanged }"   Canvas.Left="358" Canvas.Top="31" Margin="0" Width="284"></TextBox>
            <TextBlock Text="Error:" Canvas.Left="310" Canvas.Top="45"></TextBlock>-->

            <TextBox  Text="{Binding ErrorCode, UpdateSourceTrigger=PropertyChanged}"   Canvas.Left="203" Canvas.Top="70" Width="369" HorizontalAlignment="Left" VerticalAlignment="Center"/>

            <TextBlock Text="_STA {Code}" Canvas.Left="204" Canvas.Top="10"></TextBlock>
            <TextBlock Text="State Code:" Canvas.Left="99" Canvas.Top="30"></TextBlock>
            <TextBox  Text="{Binding StateCode, UpdateSourceTrigger=PropertyChanged}"   Canvas.Left="203" Canvas.Top="28" Margin="0" Width="74" IsReadOnly="False"/>

            <CheckBox Content="Event" IsChecked="{Binding EventChecked}" Canvas.Left="36" Canvas.Top="110"></CheckBox>

            <TextBlock Text="_Event {Code}" Canvas.Left="204" Canvas.Top="91"></TextBlock>
            <TextBlock Text="Event Code:" Canvas.Left="99" Canvas.Top="110"></TextBlock>


            <TextBox  Text="{Binding EventCode, UpdateSourceTrigger=PropertyChanged}"   Canvas.Left="203" Canvas.Top="107" Margin="0" Width="550" IsReadOnly="False"/>

        </Canvas>


        <StackPanel Grid.Row="2" Orientation="Horizontal" Width="900">
            <Button Content="Clear Log" Width="100" Height="35"   Command="{Binding ClearLogCommand}"></Button>

        </StackPanel>


        <DataGrid Grid.Row="3" FontSize="16" AutoGenerateColumns="False" CanUserAddRows="False" CanUserResizeRows="False" CanUserSortColumns="False" ItemsSource="{Binding TransactionLogItems}" 
                      ScrollViewer.CanContentScroll="True" 
                      ScrollViewer.VerticalScrollBarVisibility="Auto"
                      ScrollViewer.HorizontalScrollBarVisibility="Auto"
                      Width="900" Height="380" VerticalAlignment="Top">
            <DataGrid.Columns>

                <DataGridTextColumn Header="Time" Width="160" IsReadOnly="True" Binding="{Binding OccurTime, UpdateSourceTrigger=PropertyChanged}"/>

                <DataGridTextColumn Header="Incoming" Width="350" IsReadOnly="True"  Binding="{Binding Incoming, UpdateSourceTrigger=PropertyChanged}">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="TextWrapping" Value="Wrap"/>
                            <Setter Property="Height" Value="auto"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>


                <DataGridTextColumn Header="Outgoing" Width="350" IsReadOnly="True"  Binding="{Binding Outgoing, UpdateSourceTrigger=PropertyChanged}">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="TextWrapping" Value="Wrap"/>
                            <Setter Property="Height" Value="auto"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>

            </DataGrid.Columns>
        </DataGrid>
    </Grid>

</UserControl>